I'm trying to extrude from a sketch that belongs to a component that has a non-standard origin
The origin has the y and z axes switched and is translated <1,1,1>. This is shown in the figure below.
I'm using this code to create the extrusion and get the error posted below:
boltComp = self.RWO boltSketches = boltComp.sketches # reportMessageBox("building bolt", ("random")) xyPlane = boltComp.xYConstructionPlane planes = boltComp.constructionPlanes planeInput = planes.createInput() #offset plane example offsetValue = adsk.core.ValueInput.createByReal(0); planeInput.setByOffset(xyPlane, offsetValue) plane = planes.add(planeInput) sketch = boltSketches.add(plane) center = boltComp.originConstructionPoint.geometry vertices = [] for i in range(0, 6): vertex = adsk.core.Point3D.create(center.x + (self.hDiameter/2) * math.cos(math.pi * i / 3), center.y + (self.hDiameter/2) * math.sin(math.pi * i / 3),0) vertices.append(vertex) for i in range(0, 6): sketch.sketchCurves.sketchLines.addByTwoPoints(vertices[(i+1) %6], vertices[i]) extrudes = boltComp.features.extrudeFeatures prof = sketch.profiles[0] extInput = extrudes.createInput(prof, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) distance = adsk.core.ValueInput.createByReal(self.hHeight) extInput.setDistanceExtent(True, distance) headExt = extrudes.add(extInput)
Solved! Go to Solution.
Solved by nnamfoh. Go to Solution.
Solved by ekinsb. Go to Solution.
I'm able to reproduce the problem you've reported. It's a bug in the API. I've reported it so we can work on fixing it. It's specific to the orientation of your occurrence. When I first tested it it was working ok but I had an arbitrary orienation for my occurrence and when I repositioned to the orientation you described the problem occurred. I actually found another problem too where the construction plane being created is not oriented correctly. We'll get that fixed too.
A temporary solution that worked for me was to only rotate the component after fully creating the design. This problem was specific to the orientation but the extrusion was always angled relative to the document space rather than the component.