Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to display the preview by tabs

0 REPLIES 0
Reply
Message 1 of 1
quarmiere
276 Views, 0 Replies

How to display the preview by tabs

I'm writing the script which generate tool path for special situation (optimized for our machine).

 

Then I have a problem with tool path preview. 

My script has some tabs and generate tool path by tabs. So I want to display a preview of the active tab and hide tool paths of deactivated tabs.

 

For the purpose, I've tried to multiple create Preview Handler by tabs and connect to 'cmd.executePreview' but it don't go well.

There are no preview until parameters (in all tabs) is entered and tool path of deactivated tabs are existing.

 

In other words, I want to implement same thing as fusion manufacture methods.

The methods have a multiple tabs and display only the preview of active tab. (In geometry tab it shows us a stock outline / In heights tab it shows us a planes)

 

 

I've written the code like this,

 

class tab1preview(adsk.core.CommandEventHandler):

    def __init__(self):

        super().__init__()

    def notify(self, args):

        try:

            cmdArgs = ask.core.CommandEventArgs.cast(args)

            inputs = cmdArgs.command.commandInputs

            preview_tab1(inputs)  # function that preview the tool path is generated by tab1 parameters

 

class tab2preview(adsk.core.CommandEventHandler):

    def __init__(self):

        super().__init__()

    def notify(self, args):

        try:

            cmdArgs = ask.core.CommandEventArgs.cast(args)

            inputs = cmdArgs.command.commandInputs

            preview_tab2(inputs)  # function that preview the tool path is generated by tab2 parameters

 

class CmdCreatedHandler(ask.core.CommandCreatedEventHandler):

----

    def notify(self, args):

        try:

            cmd = ask.core.Command.cast(args.command)

 

            ontab1preview = tab1preview()

            cmd.executePreview.add(ontab1preview)

            _handlers.append(ontab1preview)

 

            ontab1preview = tab2preview()

            cmd.executePreview.add(ontab2preview)

            _handlers.append(ontab2preview)

 

 

Labels (1)
  • API
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report