Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Everyone,
I'm using the code below at an .IPT level to control how a flange on a part grows/shrinks using the Width Extents function. This code works great at the part level however I would like to create a sub-assembly of this component and iLogic Place this subassembly into a higher level assembly. Currently the code below gives me an error and I'm unable to use the form I created at the assembly level to control the part level features. How do I augment this code to make it work at an assembly level. I still want to be able to control the flange using the Width Extents method but I would like to be able to iLogic place this component in a subassembly.
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
Dim oAfter As Object
Dim oBefore As Object
oCompDef.GetEndOfPartPosition(oAfter, oBefore)
Dim oFlangeFeature As FlangeFeature
For Each oFlangeFeature In oCompDef.Features.FlangeFeatures
If oFlangeFeature.Name = "Flange3" Then
Exit For
End If
Next
If oFlangeFeature Is Nothing Then Exit Sub
oFlangeFeature.SetEndOfPart (True)
Dim oFlangeDef As FlangeDefinition = oFlangeFeature.Definition
Dim oEdge As Edge = oFlangeDef.Edges(1) 'assuming there is only one edge
Dim oOffsetEntOne As Object = oEdge.StartVertex
Dim oOffsetEntTwo As Object= oEdge.StopVertex
oFlangeDef.SetOffsetWidthExtent(oFlangeDef.Edges(1), oOffsetEntOne, 0.5, oOffsetEntTwo, 0.5)
If Not oAfter Is Nothing Then
oAfter.SetEndOfPart (False)
ElseIf Not oBefore Is Nothing Then
oBefore.SetEndOfPart (True)
End If
ThisApplication.ActiveView.Update
Solved! Go to Solution.