- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create my first script. I've made it as far as creating a sketch with two nested, constrained rectangles in it. Now I want that sketch to line up with an existing sketch.
I can get it on the same plane, but the coordinate system is rotated vs what I expect. The bottom sketch's geometry is supposed to be in the positive XY quadrant, but as you can see it gets inserted rotated. This is a clean test design with a sketch with one rectangle on it.
How can I copy the existing sketch's origin, size and coordinate system? Ideally I want to pick any existing sketch and place my generated sketch and its geometry on the same plane, or on an offset plane directly "above" the existing plane and sized exactly the same. It's my intent to generate patterned geometry to intersect and cut the existing geometry.
# Create a new sketch.
thisComp = design.rootComponent
sketches = thisComp.sketches
masterSketch = sketches.item(0)
# Get the profile
prof = masterSketch.profiles.item(0)
# Get construction planes
planes = thisComp.constructionPlanes
# Create construction plane input
planeInput = planes.createInput()
# Add construction plane by offset
offsetValue = adsk.core.ValueInput.createByReal(0)
planeInput.setByOffset(prof, offsetValue)
planeOne = planes.add(planeInput)
sketch = sketches.add(planeOne)
Solved! Go to Solution.