- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to get the profile of an array of components into a single sketch using the API. I have tried several methods and have run into the same 'Internal Validation' error and would like some help:
I have these components arranged below:
This is the end result I am trying to achieve, which I did here by projecting to a sketch in the GUI:
The height of the sketch is irrelevant to me. The first method I tried is to simply make a new plane, add a sketch to the plane, and project the top face to the sketch:
rootComp = design.rootComponent
sketches = rootComp.sketches
planes = rootComp.constructionPlanes
planeInput = planes.createInput()
offsetValue = adsk.core.ValueInput.createByReal(sliceThickness*5)# actual offset value is arbitrary
planeInput.setByOffset(rootComp.xZConstructionPlane, offsetValue)
# makes a new plane out of the plane inputs. Returns this plane
plane = planes.add(planeInput)
# add a sketch to this new plane
newLayerSketch = sketches.add(plane)
# get sketch intersections
for c in design.allComponents:
# dont want to include original component in this projection
if c.name != rootComp.name:
capFace = c.features.extrudeFeatures.item(0).endFaces.item(0)
newLayerSketch.project(capFace)
I get this internal validation error:
text:
"""
Failed:
Traceback (most recent call last):
File "C:/Users/jssml/Documents/Layer Print/sw/gitPull/layerprint/fusion360/Slice/Slice.py", line 31, in run
writeDXF(datamanag[sysData.WRITEPATH], datamanag[sysData.WRITENAME], design, sliceThickness)
File "C:/Users/jssml/Documents/Layer Print/sw/gitPull/layerprint/fusion360/Slice/Slice.py", line 382, in writeDXF
newLayerSketch.project(capFace)
File "C:\Users/jssml/AppData/Local/Autodesk/webdeploy/production/dbacedcc6dabacdc41406088a765962c5f1923ad/Api/Python/packages\adsk\fusion.py", line 39128, in project
return _fusion.Sketch_project(self, entity)
RuntimeError: 2 : InternalValidationError : Utils::getObjectPath(entity, objPath, occ, contextPath)
"""
After not being able to deduce the issue, I tried several other methods of achieving the same result:
- Projecting the body to the sketch and not the face
- creating a plane in the middle of the thickness of the components and generating an intersection sketch with this plane and all the components shown
- Trying this with the component objects and the bodies of the components
- Including the rootComponent in the projections and intersections, even though I want the rootComponent excluded from the final sketch
These all result in the same validation problem, always at the line where I am trying to add the profile of these components to the sketch, whether that is via the intersection or projection method. Looking at multiple other InternalValidationError posts, they seem to be related to a potential bug in Fusion. Hard to tell how related this is.
I am sure there are multiple other ways to do what I want, which I am more than willing to try. Just want to see if there is nothing obvious I am doing wrong here that generates this error that can be easily remedied first.
Thanks
Jesse
Solved! Go to Solution.