Inkscape.org
Creating New Extensions path to gcode -origin problem
  1. #1
    costycnc costycnc @costycnc

    I modified flatten.py https://github.com/piksels-and-lines-orchestra/inkscape/blob/master/share/extensions/flatten.py for create gcode.

    My project here https://github.com/costycnc/costycnc-inkscape-plugin-hello-world/blob/master/costycnc/costycnc.py

    I not understand because when create a letter ... for example "a" ... object to path ... and execute my extension ,,, the gcode coordinates is too far from origin ... see photo...

    the node of path not begin with appropiate zero ... but with high value ... any help?

     

    B
    A
  2. #2
    Martin Owens Martin Owens @doctormo🌹🧀

    General warning: your code is the old style code for Inkscape 0.92, you should be aware that Inkscape 1.0 has a new python extensions API with new functions and ways of writing the code. See here: https://wiki.inkscape.org/wiki/index.php/Updating_your_Extension_for_1.0

    The second point about origin looks like a problem with transforms. Applying transforms to paths can make sure the position you end up with is the position you intend. You can see examples here: https://gitlab.com/inkscape/extensions/-/blob/master/extrude.py#L37

  3. #3
    costycnc costycnc @costycnc

    thanks for response! im not advanced programmer and i spend more time to learn something about extension inkscape ... im afraid that if passed to actual version all of my works is not compatible and i dont know how repair extension... i did ... im not advanced programmer ... so of your suggestion i download https://github.com/Klowner/inkscape-applytransforms

    and seem to working ,

    and now another question ... can find a extension of a modality to change entry point of a path? Like rotate nodes of path? I see that if rotate path the entry point is the same ... and i like if can change the entry point ... for my example the entrypoint of path is a legs of snow-white... but i want make to head of snow-white... i can rotate image for entry point to be up ... but is posible to set entry path?

    thanks!

    Untitled
  4. #4
    Martin Owens Martin Owens @doctormo🌹🧀

    I'm not sure. The apply transform code you've found is old school too, so you're going to end up with an extension that may not work well going forwards with newer inkscape versions.

    Otherwise though. I'm not sure. If you add a rotation to the path element, and then run it over apply transform again you should end up with the path rotated.

  5. #5
    costycnc costycnc @costycnc

    Thanks! I have tons of questions! But another one and no more! Because i do not want open a new post! How can get coordinates a point of selected path? Because i not want use polyshaper plugin ... i want to create a simple plugin that user can select the node of two path and plugin unite the nodes .... same as photo ...polyshaper make in automatic

    2
    1
  6. #6
    Martin Owens Martin Owens @doctormo🌹🧀
    *

    Node selections aren't passed into extensions, so there's no way to do it via extensions. It would have to be done as a C++ Inkscape feature.

  7. #7
    costycnc costycnc @costycnc
    😀

    thanks... you  help me for not spend time on internet ...

  8. #8
    Martin Owens Martin Owens @doctormo🌹🧀

    Actually. I'm wrong. Nodes are passed in using the 'selected_nodes' argument. In the 1.0 extensions this is available as self.args['selected_nodes'] but it's not an argument used in any core extensions so it's not well tested or provided for.