In our sheetmetal parts we use the Mark-tool to create an identification text that wil be engraved. This Mark-feature is created and placed in the Folded Model. In the Flat Pattern this identification is of course visible as a consequence. Our sheetmetal supplier wants to have DXF files in which the flat-pattern is visible but also wants two or three views of the folded model, if folds are present. We created a VBA macro that finds all sheetmetal parts in an assembly, creates Inventor-dwg files in which the flat-pattern and, if necessary, the views of the folded model are placed. These dwg files will then be exported as final DXF-files by the use of another macro.
Now, the problem is, the contourlines of the Marking features in all views are all put in the "Visible (ISO)"-layer. I'd like to have all lines that are created by Mark-features in the views of the folded model as well as in the view with the flat-pattern be put in the "Laser Engraving"-layer instead.
I tried to create a VBA program in which I can select the flat-pattern-view and iterate through all edges found, but I guess there's no way to find out to which feature those countless edges belong.
Is there a way in VBA/iLogic to find the Mark features of the folded sheetmetal-document displayed on the dwg, have the associated contourlines of the Mark features selected (for both folded- and flat-pattern views!) and put in the "Laser Engraving"-layer?
Help is greatly appreciated. I've put two files in this message, the dwg contains both the flat-pattern view and the projections of the folded model.
Hi @miechh,
very interesting challenge.
Unfortunately, I have not found a solution yet.
The assignment is relatively easy in the part. The CreatedbyFeature property can be used to assign each edge or surface etc. to the feature used.
If I try the same via the drawing and try to find out from which model feature, for example, a DrawingCurveSegment was created, then an error is stored as the value.
A little frustrating. Maybe we'll find something else.
Best regards,
Hi @fullevent. I am working on other stuff right now, so no time for testing on attached files, but a couple ideas come to mind that may help in this process. Instead of getting all curves from the view, then working backwards, trying to figure out which feature in the model is responsible for them, try doing it the other way around. When you use the DrawingView.DrawingCurves property, specify the MarkFeature as the 'model object' to input. Then you should get all the view geometry belonging to that feature in one DrawingCurvesEnumerator. Another thing to keep in mind is 'context' (or edit mode, if that makes more sense). If the view is a flat pattern view, then the context of the model geometry associated with the 2D curves in that view will be in the flat pattern mode of the model file. I'm not sure if you are aware of this or not, but the FlatPattern object is derived from the ComponentDefinition, so it is capable of having its own, separate set of parameters, features, and other such things. When in 'folded' mode, you will not even see the parameters defined within the FlatPattern available within the Parameters dialog. So, you may need to transition from scope of the FlatPattern into the 'folded' scope, before you can access the feature that was defined within the 'folded' mode. If the feature was added in 'flat pattern' mode, then it would not be available in the 'folded' mode...unless you used fold/unfold features in the process, or something odd like that, maybe. Just some food for thought.
Edit: I should probably add this link in here too, to avoid confusion, because the 'folded' model of a sheet metal part is in the SheetMetalComponentDefinition (which is derived from the PartComponentDefinition, but is further customized for sheet metal stuff). To get access to that type of 'definition', create a variable of that Type, then set the variable's value using the PartDocument.ComponentDefinition property, which just says that it returns a normal PartComponentDefinition, in the documentation. But you will get the SheetMetalComponentDefinition type instead.
Wesley Crihfield
(Not an Autodesk Employee)
Can't find what you're looking for? Ask the community or share your knowledge.