Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

To move an SVG and selection of axis through API

Anonymous

To move an SVG and selection of axis through API

Anonymous
Not applicable

Is there any way to call these from API? Either using the text commands or some in-built function?

 

ques 1.PNG

 

ques 2.PNG

 

0 Likes
Reply
387 Views
4 Replies
Replies (4)

Anonymous
Not applicable

@kandennti do you have any idea on this?

0 Likes

kandennti
Mentor
Mentor

Hi @Anonymous .

 

This is how to call "SVG Import" in the GUI.

#Fusion360API Python script
import adsk.core, adsk.fusion, traceback

def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface

        # call SketchImportSVG
        app.executeTextCommand(u'Commands.Start SketchImportSVG')

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
0 Likes

Anonymous
Not applicable

@kandennti thank you for your reply! 
I already have imported the image through importSvg() function in code, but since svg image fixes on the grid and there is no way to move it i just want to add the 'move' functionality so that as soon as the import is done the move palette is triggered to place the image where ever the user desires. Is there any way to trigger just the 'move' functionality?

0 Likes

kandennti
Mentor
Mentor

I do not know how to do the move you want.
There is a "Move/Copy" command to move it after placement.


As you can see in the GUI, the lines are fixed after importing with the importSVG method. Therefore
Unfix(Id:SketchFixConstraintCmd)  ->  Move line(Id:FusionMoveCommand)  ->  Fix
process will be required.


We also need to detect the end of the move in order to fix it again. This will probably require the use of threads and CustomEvents, and I have a feeling that it will require a rather large system.

0 Likes