Message 1 of 2
creating rectangle by two points Internal validation error

Not applicable
09-07-2017
06:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm creating a script which generates a bounding box around a set of bodies. Once I have the BoundingBox3D object I start creating a rectangular sketch in the xz plane. I project construction points from the min and max point onto this plane and try to create a rectangle by the new sketch points. I get an error after the projected sketchPoints are created and during creation of the 2 point rectangle. What could be causing this?
Code and error below:
occ = smartGeometry.design.rootComponent.allOccurrencesByComponent(smartGeometry.component).item(0) base = smartGeometry.component.features.baseFeatures.add() base.startEdit() minPointInput = smartGeometry.component.constructionPoints.createInput(occ) minPointInput.setByPoint(boundingBox.minPoint) minPoint = smartGeometry.component.constructionPoints.add(minPointInput) maxPointInput = smartGeometry.component.constructionPoints.createInput(occ) maxPointInput.setByPoint(boundingBox.maxPoint) maxPoint = smartGeometry.component.constructionPoints.add(maxPointInput) base.finishEdit() lowerPlaneInput = smartGeometry.component.constructionPlanes.createInput(occ) lowerPlaneInput.setByOffset(smartGeometry.component.xZConstructionPlane, adsk.core.ValueInput.createByReal(minPoint.geometry.y)) lowerPlane = smartGeometry.component.constructionPlanes.add(lowerPlaneInput) sketch = smartGeometry.component.sketches.add(lowerPlane) minP = sketch.project(minPoint) maxP = sketch.project(maxPoint) sketch.sketchCurves.sketchLines.addTwoPointRectangle(minP, maxP) extrudes = smartGeometry.component.features.extrudeFeatures prof = sketch.profiles[0] extInput = extrudes.createInput(prof, adsk.fusion.FeatureOperations.NewBodyFeatureOperation) distanceExtent = adsk.fusion.DistanceExtentDefinition.create(adsk.core.ValueInput.createByReal(maxPoint.geometry.y-minPoint.geometry.y)) extInput.setOneSideExtent(distanceExtent, adsk.fusion.ExtentDirections.PositiveExtentDirection) return extrudes.add(extInput)