Flip the direction of distance dimension
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm writing a Python script to generate components for me. I first create new sketch points roughly where they're going to be and then constrain them properly. However, one distance dimension for a line length keeps flipping the points of the line around.
Please take a look at the attachments to see what I mean. Both sketches are identical in their constraints and dimensions. As long as I don't add the dimension to the horizontal line the correct orientation is with the diagonal lines on the right side. However once I add a dimension, the two end points of the line swap places and thus the whole sketch flips.
horizontal = lines.addByTwoPoints(point(5, 0), point(-5, 0)) horizontal.isConstruction = True constraints.addHorizontal(horizontal) constraints.addMidPoint(sketch.originPoint, horizontal)
dimensions.addDistanceDimension(horizontal.startSketchPoint, horizontal.endSketchPoint, adsk.fusion.DimensionOrientations.HorizontalDimensionOrientation, point(1, 1)).parameter._set_expression(str(referenceDiameterGear))
This is the code with which I add the horizontal line and its dimensions. I have also tried swapping the places of startSketchPoint and endSketchPoint, but that doesn't change anything.
How can I make sure these points aren't being flipped after adding the dimension? The same problem also occurred to me occasionally while manually creating sketches and I couldn't figure out how to deal with it manually either.