Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have the following script which creates, a circular sketch, 2 sketch points and 2 sketch lines (as below).
The code for this is shown below (based on the Construction Plane API sample)
import adsk.core, adsk.fusion, traceback
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
# Create sketch
sketches = rootComp.sketches
sketch = sketches.add(rootComp.xZConstructionPlane)
# Create sketch circle
sketchCircles = sketch.sketchCurves.sketchCircles
centerPoint = adsk.core.Point3D.create(0, 0, 0)
sketchCircles.addByCenterRadius(centerPoint, 5.0)
# Create sketch line
sketchLines = sketch.sketchCurves.sketchLines
startPoint = adsk.core.Point3D.create(5, 5, 0)
endPoint = adsk.core.Point3D.create(5, 10, 0)
sketchLineOne = sketchLines.addByTwoPoints(startPoint, endPoint)
endPointTwo = adsk.core.Point3D.create(10, 5, 0)
sketchLineTwo = sketchLines.addByTwoPoints(startPoint, endPointTwo)
# Create two sketch points
sketchPoints = sketch.sketchPoints
positionOne = adsk.core.Point3D.create(0, 5.0, 0)
sketchPointOne = sketchPoints.add(positionOne)
positionTwo = adsk.core.Point3D.create(5.0, 0, 0)
sketchPointTwo = sketchPoints.add(positionTwo)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
`startPoint` which is created with coordinates (5, 5, 0) is placed in position (5, 0, -5) according to my axis in the top right corner. Given that the sketch is on the xZConstructionPlane I would be able to understand how specifying (5, 5, 0) ends up as (5, 0, 5), but I cannot understand how (5, 5, 0) maps to (5, 0, -5)??
Solved! Go to Solution.