Hello.
Im just getting started with API and would like you to show me some guidelines.
For my first project Im trying to following:
Assembly document is open. In this assembly there is a sheet metal part called "BAR"
Now what i want to do is select one of sheet metal part edges using pick function and add a flange to that edge.
Something like this was able to do that in in part environment:
Public Sub addflange() Dim oSheetMetalDoc As PartDocument Set oSheetMetalDoc = ThisApplication.ActiveDocument Dim oCompDef As SheetMetalComponentDefinition Set oCompDef = oSheetMetalDoc.ComponentDefinition Dim oSheetMetalFeatures As SheetMetalFeatures Set oSheetMetalFeatures = oCompDef.Features 'Pick edge Dim oEdge As Object Set oEdge = ThisApplication.CommandManager.Pick(kPartEdgeFilter, "edge") 'Add edge to edges collection Dim oEdgeC As EdgeCollection Set oEdgeC = ThisApplication.TransientObjects.CreateEdgeCollection Call oEdgeC.Add(oEdge) 'Create flange definiton Dim oFlangeDef As FlangeDefinition Set oFlangeDef = oSheetMetalFeatures.FlangeFeatures.CreateFlangeDefinition(oEdgeC, "45 deg", 20) 'Add flange Dim oFlangeFeature As FlangeFeature Set oFlangeFeature = oSheetMetalFeatures.FlangeFeatures.Add(oFlangeDef) End Sub
But I need it to be done in ASSEMBLY environment.
So that the active document would be assembly document, select PART edge from ASSEMBLY document (i think this is where i get lost) and then add flange to this sheet metal part file.
Am I on heading to the right direction?
Any suggestions?
Solved! Go to Solution.
Solved by askokk. Go to Solution.
Got it working.
It turns out that "Edge proxies" are allready there.. no need to create one:D
I just had to use EdgeProxy.NativeObject instead of just Edge.