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: 

Is it possible to isolate a component via API?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
luca.giorcelli9CG7C
300 Views, 3 Replies

Is it possible to isolate a component via API?

I'm trying to isolate a component via API in order to export a thumbnail using Viewport.saveAsImageFile(filename, width, height). I've hundreds of component, so I need to do that programmatically.

 

In the API reference I cannot find any method to accomplish this simple task.

 

Any help is appreciated.

3 REPLIES 3
Message 2 of 4

@luca.giorcelli9CG7C here are few references I found related to isolation of component. 

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-bb040782-b1b0-4ffe-b0f7-3cd97533b9c5

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-7cd5b52f-26bb-4890-9c37-2dc48213d685

Also, refer to below sample code where in I created two components and then isolated one and performed unisolate operation on the same component.

 

import adsk.core, adsk.fusion, traceback
import time
def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface
        
        # Create a document.
        doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
 
        product = app.activeProduct
        design = adsk.fusion.Design.cast(product)

        # Get the root component of the active design
        rootComp = design.rootComponent
                
        # Get extrude features
        extrudes = rootComp.features.extrudeFeatures

        # Create sketch     
        sketches = rootComp.sketches   
        sketch = sketches.add(rootComp.xZConstructionPlane)
        sketchCircles = sketch.sketchCurves.sketchCircles
        centerPoint = adsk.core.Point3D.create(0, 0, 0)
        circle = sketchCircles.addByCenterRadius(centerPoint, 5.0)
        
        # Get the profile defined by the circle
        prof = sketch.profiles.item(0)
        
        # Create another sketch
        sketchVertical = sketches.add(rootComp.yZConstructionPlane)
        sketchCirclesVertical = sketchVertical.sketchCurves.sketchCircles
        centerPointVertical = adsk.core.Point3D.create(0, 10, 0)
        cicleVertical = sketchCirclesVertical.addByCenterRadius(centerPointVertical, 0.5)    
        
        # Get the profile defined by the vertical circle
        profVertical = sketchVertical.profiles.item(0)

        distance = adsk.core.ValueInput.createByReal(5)
        extrude1 = extrudes.addSimple(prof, distance, adsk.fusion.FeatureOperations.NewComponentFeatureOperation)

        distance2 = adsk.core.ValueInput.createByReal(5)
        extrude2 = extrudes.addSimple(profVertical, distance2, adsk.fusion.FeatureOperations.NewComponentFeatureOperation)

        occ1 = rootComp.allOccurrences.item(0)
        occ1.isIsolated = True

        ui.messageBox('Component 1 isloated. It will be unisolated on OK')

        occ1.isIsolated = False

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

 

 

If it works out, do click on accept solution button.

 

Regards,

Rushikesh Kadam




Rushikesh Kadam
Senior QA Engineer
Quality Assurance
Autodesk, Inc.


Message 3 of 4

It was so simple!!!

isIsolated

 

But where is located this command in the API reference?

 

Message 4 of 4

Here is the link to reference 

http://help.autodesk.com/view/fusion360/ENU/?guid=GUID-bb040782-b1b0-4ffe-b0f7-3cd97533b9c5

 

If it worked out, do click on accept solution button.

 

Regards,

Rushikesh Kadam.




Rushikesh Kadam
Senior QA Engineer
Quality Assurance
Autodesk, Inc.


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