Python API Offset statement of 0.12 cm leaves dimension of 0.00 in drawing.

Python API Offset statement of 0.12 cm leaves dimension of 0.00 in drawing.

Anonymous
Not applicable
1,268 Views
5 Replies
Message 1 of 6

Python API Offset statement of 0.12 cm leaves dimension of 0.00 in drawing.

Anonymous
Not applicable

Condition:

Fusion 360 Build 20.5278

Windows 10, Startup License

 

Model file with a simple profile (location: https://a360.co/2LkT4NJ )

Attached python script.

 

Run Python Script.

Expect the first sketch profile to be selected to which an offset (with a reference point) is created .12 cm (1.2 mm) to the outside of the profile. The reference point is assumed to be outside the profile (within the context of this usage).

 

Observation:

After running the script, the sketch was edited. There was a dimension applied to the offset which had a value of 0.00. The offset was measured at 1.2 mm with the Measure tool. 

 

Comments:

My normal unit preferences are in mm.

 

 

-------------

 

#Author-mwinrock
#Description-Locates first sketch profile in root compenet and attempts to create an offset.

import adsk.core, adsk.fusion, adsk.cam, traceback
bUpdateFusion=True


        
def run(context):
    ui = None
    try:
        app = adsk.core.Application.get()
        ui  = app.userInterface
        
        # at this point in time, the user must load the sketch profile.
        #doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
        
        design = app.activeProduct

        # Get the root component of the active design.
        rootComp = design.rootComponent

        sketch = rootComp.sketches.item(0)
        
        prof_1 = sketch.profiles.item(0)
        
        
        

        
        # create offset from profile
        line = sketch.sketchCurves.item(0)
        curves = sketch.findConnectedCurves(line)
        

        
        # Create the offset.
        dirPoint = adsk.core.Point3D.create(1000, 1000, 1000)
        offsetCurves = sketch.offset(curves, dirPoint, 0.12)
        prof_2 = sketch.profiles.item(1) 
        
        if bUpdateFusion:
            # Call doEvents to give Fusion 360 a chance to react.
            adsk.doEvents()
            

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
0 Likes
1,269 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

I had a similar problem (C++ code) - but I was too lazy to report itSmiley Frustrated

Might be a bug in the API.

And it's not just sketch-dimension cosmetic. As far as I can remember a "Compute All" took the 0 (zero) value and the resulting geometry no longer had an offset.

0 Likes
Message 3 of 6

PinRudolf
Advocate
Advocate

I encountered the same issue in version 2.0.6045. My current solution is to change the placed dimension to the correct value. 

0 Likes
Message 4 of 6

goyals
Autodesk
Autodesk

Thanks you for posting it, We will investigate it further.



Shyam Goyal
Sr. Software Dev. Manager
0 Likes
Message 5 of 6

goyals
Autodesk
Autodesk

We fixed this issue and it would be part of Fusion December release. Thanks.



Shyam Goyal
Sr. Software Dev. Manager
Message 6 of 6

sougata.mukherjee
Alumni
Alumni

Hi ,
We have fixed this issue , the fix has been targeted for December release.

Thanks

0 Likes