Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to create a sketch on an offset plane parallel to yZConstructionPlane. But every time, the coordinates shift on the lower right status bar. Can someone explain why Fusion does that?
Because of this, it gets tricky to put coordinates in Point3D.create(x,y,z). Is there any solution to this problem?
Here is the code sample:
import adsk.core
import adsk.fusion
import adsk.cam
import traceback
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
design = adsk.fusion.Design.cast(app.activeProduct)
rootComp = design.rootComponent
sketches = rootComp.sketches
yzPlane = rootComp.yZConstructionPlane
planes = rootComp.constructionPlanes
planeInput = planes.createInput()
offsetDistance1 = adsk.core.ValueInput.createByString('250')
planeInput.setByOffset(yzPlane, offsetDistance1)
plane = planes.add(planeInput)
sketch = sketches.add(plane)
sketchPoints = sketch.sketchPoints
centerPoint= adsk.core.Point3D.create(0, 0, 0)
cornerPoint = adsk.core.Point3D.create(4, 4, 0)
a = sketchPoints.add(centerPoint)
b = sketchPoints.add(cornerPoint)
rectangles = sketch.sketchCurves.sketchLines
rectangle = rectangles.addCenterPointRectangle(centerPoint, cornerPoint)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
As you can see the coordinates given in x,y are shifted to y,z.
Solved! Go to Solution.