gotcha

Author Topic: Tring to get the <id> and <_name> values from the .inx into the .py script  (Read 344 times)

June 30, 2019, 10:32:08 AM
Read 344 times

hoek67

  • Newbie

  • Offline
  • *

  • 1
Hi, I'm quite new to writing extensions but have been altering and adding parameters to one that saves paths as an open SCAD format.

Everything is working fine... except I'm stuck on trying to somehow get <id> and <_name> into the python script so I can write the values into comments.

Tried to find a way to grab the values directly... then tried to make a hidden parameter in the .INX file to pass it.

Code: [Select]
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>OpenSCAD Bezier V1.0</_name>
<id>au.gov.aims.openscad.bezier</id>

Have been googling for a few hours now and no closer.

The full .INX is attached.

I need to be able to either "copy" the values into the hidden parameter default values or find a way in the .py script to just read the values similar to what's done with :-

Code: [Select]
  self.m_prec = int(self.options.prec) 
  self.m_testcode = int(self.options.testcode)
  self.m_suffix =  makeSuffix(self.options.fn) # make sure a valid name
  self.m_name1 = "imageDim_" + self.m_suffix
  self.m_name2 = "imageDraw_" + self.m_suffix
  self.m_libcode = makeSuffix(self.options.libcode)  # whether to include internal bezier library code
  self.m_libname = makeLibname(self.options.libname)

Any help appreciated.
  • 0.92.4
  • Ubantu latest 64 bit

June 30, 2019, 08:15:21 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

I can't help hardly at all with this, although we have other members who probably can.  The only thing I could suggest is to look at existing extensions which might do something similar.

If you look on the Home tab (above) and scroll down to the bottom half of the page, you'll see the listings of external Inkscape extensions.  Click on the Export list item, and it will expand.  Then scroll down to the SCAD section.  Or you might see another extension in that extensive listing, that might do something similar.

Hopefully someone else will be along before too long  :)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

July 01, 2019, 04:26:19 AM
Reply #2

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
I think extension Python files only get the parameters the user set in the dialog, the selection, and the SVG file passed to them, but not which inx file called them.

You could create a hidden parameter, maybe, where you put the info you want to pass into the SVG file?
Or just put it into the Python file - I'm not sure I understand why you don't want to do that.

http://wiki.inkscape.org/wiki/index.php/INX_Parameters#gui-hidden