fsmMLK / inkscapeLogicGates

Inkscape extension to assist creating logic circuits symbols, following the 'distinctive shape' of IEEE Std 91/91a-1991 standard.
GNU General Public License v3.0
53 stars 9 forks source link

Value error in numpy when creating a D flip flop #1

Closed dmjacobson closed 7 years ago

dmjacobson commented 7 years ago

I"m brand new to inkscapeLogicGates. I am running on Ubuntu Linux 16.04 LTS. I downloaded all the stuff including inkscapeMadeEasy, and also installed latex (TeXlive), pygtk, Tkinter, and pdf2svg. Then I tried to make a D flip flop (large, no control gates, high logic, active high clear).

I get an error with this traceback

Traceback (most recent call last): File "logicGates.py", line 671, in logic.affect() File "/usr/share/inkscape/extensions/inkex.py", line 268, in affect self.effect() File "logicGates.py", line 122, in effect asynPreset=int(so.latchPreset),asynClear=int(so.latchClear),size=so.latchSize,suppressq=so.latchSuppressq, suppressNOTq=so.latchSuppressNOTq) File "logicGates.py", line 630, in createLatch self.createOutput(True,group,position=[x_max,position[1]-dist_signal],extraLength=0.0,label='Q',name='$Q$',fontSizeFactor=fontSizeFactorG) File "logicGates.py", line 266, in createOutput self.createSignal(flagTrue,parent,[position[0],position[1]],direction,extraLength,label,name,fontSizeFactor) File "logicGates.py", line 234, in createSignal inkDraw.text.latex(self,group,name,position=posText,fontSize=self.fontSize*fontSizeFactor,refPoint=justif,preambleFile=self.preambleFile) File "/usr/share/inkscape/extensions/inkscapeMadeEasy_Draw.py", line 1253, in latex BboxMin, BboxMax = ExtensionBaseObj.getBoundingBox(groupLatex) File "/usr/share/inkscape/extensions/inkscapeMadeEasy_Base.py", line 575, in getBoundingBox coords = self.getPoints(element) File "/usr/share/inkscape/extensions/inkscapeMadeEasy_Base.py", line 541, in getPoints listPoints = self.getPoints(obj) File "/usr/share/inkscape/extensions/inkscapeMadeEasy_Base.py", line 541, in getPoints listPoints = self.getPoints(obj) File "/usr/share/inkscape/extensions/inkscapeMadeEasy_Base.py", line 548, in getPoints coordsNP = np.hstack((np.array(listCoords), np.ones([len(listCoords), 1]))).transpose() File "/usr/lib/python2.7/dist-packages/numpy/core/shape_base.py", line 278, in hstack return _nx.concatenate(arrs, 0) ValueError: all the input arrays must have same number of dimensions

For whatever it is worth, I can successfully make a 2-input AND gate, so at least something is working correctly.

Added a bit later: If I disable latex, the problem goes away. But that's not a good solution since the labels on the signals are all surrounded by "$", ie. "D" input on the flip flop is labeled "$D$". I can take those out in Inkscape, but a nuisance.

fsmMLK commented 7 years ago

It seems a problem between textext and pstoedit.

Do you have pstoedit installed? apt-get install pstoedit

fsmMLK commented 7 years ago

The appearance of $ when Latex support is disabled is a bug. I will fix ASAP, thanks.

fsmMLK commented 7 years ago

Just Uploaded a new version. The annoying $ should be gone.

dmjacobson commented 7 years ago

Well, I installed pstoedit and downloaded your new version. Alas, now we have new errors.

Traceback (most recent call last): File "logicGates.py", line 682, in logic.affect() File "/usr/share/inkscape/extensions/inkex.py", line 268, in affect self.effect() File "logicGates.py", line 122, in effect asynPreset=int(so.latchPreset),asynClear=int(so.latchClear),size=so.latchSize,suppressq=so.latchSuppressq, suppressNOTq=so.latchSuppressNOTq) File "logicGates.py", line 639, in createLatch self.createOutput(True,group,position=[x_max,position[1]+dist_signal],extraLength=0.0,label='notQ',name=r'$\NOT{Q}$',fontSizeFactor=fontSizeFactorG)
File "logicGates.py", line 266, in createOutput self.createSignal(flagTrue,parent,[position[0],position[1]],direction,extraLength,label,name,fontSizeFactor) File "logicGates.py", line 234, in createSignal inkDraw.text.latex(self,group,name,position=posText,fontSize=self.fontSize*fontSizeFactor,refPoint=justif,preambleFile=self.preambleFile) File "/usr/share/inkscape/extensions/inkscapeMadeEasy_Draw.py", line 1224, in latex tex.affect([r'--text=' + LatexCommands + LaTeXtext, '--scale-factor=1', '--preamble-file=' + preambleFile, tempFilePath], output=False) File "/usr/share/inkscape/extensions/inkex.py", line 268, in affect self.effect() File "/usr/share/inkscape/extensions/textextLib/textext.py", line 388, in effect self.options.scale_factor, converter_cls, old_node) File "/usr/share/inkscape/extensions/textextLib/textext.py", line 402, in do_convert new_node = converter.convert(text, preamble_file, scale_factor) File "/usr/share/inkscape/extensions/textextLib/textext.py", line 769, in convert self.tex_to_pdf(latex_text, preamble_file) File "/usr/share/inkscape/extensions/textextLib/textext.py", line 746, in tex_to_pdf exec_command(['pdflatex', self.tmp('tex')] + latexOpts) File "/usr/share/inkscape/extensions/textextLib/textext.py", line 611, in exec_command % (' '.join(cmd), p.returncode, out + err)) RuntimeError: Command pdflatex /tmp/tmpnrv88z/tmp.tex -interaction=nonstopmode -halt-on-error failed (code 1): This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (/tmp/tmpnrv88z/tmp.tex LaTeX2e <2016/02/01> Babel <3.9q> and hyphenation patterns for 5 language(s) loaded. (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2014/09/29 v1.4h Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))

LaTeX Warning: Unused global option(s): [a0].

No file tmp.aux. ! Undefined control sequence.

\NOT l.7 $\NOT {Q}$ ? ! Emergency stop. \NOT l.7 $\NOT {Q}$ ! ==> Fatal error occurred, no output PDF file produced! Transcript written on tmp.log.
fsmMLK commented 7 years ago

did you put CircuitSymbolsLatexPreamble.tex inside textextLib subdirectory?

dmjacobson commented 7 years ago

Mea Culpa. I put CircuitSymbolsLatexPreamble.tex in the designated place and it worked. Thank you for all the help.

There is now just one issue remaining. The text on the D flip-flop is too big and overlaps. I can fix that in Inkscape, so it is not a big deal.

I'm attaching a screen shot.
screenshot from 2017-07-13 16-10-18

fsmMLK commented 7 years ago

This is odd... The sizes are OK here.

dmjacobson commented 7 years ago

I was wrong. It looks like it has been turned into paths. I can't fix the overlap in Inkscape.

fsmMLK commented 7 years ago

what happens if you choose another size?

fsmMLK commented 7 years ago

Oh, my bad! You just have to change 'font size' in the other tab (signals and expressions)

I will change that. I will fix the size to 6.0.

fsmMLK commented 7 years ago

uploaded another version where the font size is fixed.

dmjacobson commented 7 years ago

Perfect!!

Thank you.