Hi,
Inventor 2022
API. VB.NET Visual Studio
I try to Change SubType of a Part (From Part to SheetMetal) in Assembly Enviroment.
My Goal i to Create a CounterFlange
The Problem is to change the SubType Docuemnt.
I Think, the Problem is, that iam i SubAssembly, ActiveDocument is Probably the Main Assembly.
How i can make the PartDocuemnt Active in Assembly?
Is this the Problem ?
This is My Code:
Dim oArc As SketchArc
oArc = oSketchPart_A.SketchArcs.AddByCenterStartEndPoint(oPointCenterArc, oSketchLine_06.EndSketchPoint, oSketchLine_07.EndSketchPoint)
Dim oPathline As Path = oPart_A_Def.Features.CreatePath(oArc)
oOccAssembly_Middle.Edit()
'oOccPartA.Edit()
Dim oRefComponents As ReferenceComponents = oPart_A_Def.ReferenceComponents
g_inventorApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
oPartA.Update()
Dim oSheetCompDef As SheetMetalComponentDefinition = oPartA.ComponentDefinition
Dim oSheetMetallFeatures As SheetMetalFeatures = oSheetCompDef.Features
Dim oStyle As SheetMetalStyle
oStyle = oSheetCompDef.SheetMetalStyles.Item(1)
oStyle.Thickness = "2"
oStyle.BendRadius = "Stärke"
oStyle.BendReliefDepth = "Stärke * 0.5"
oStyle.BendReliefShape = BendReliefShapeEnum.kRoundBendReliefShape
oStyle.BendReliefWidth = "Stärke"
oStyle.BendTransition = BendTransitionEnum.kArcBendTransition
oStyle.BendTransitionArcRadius = "Stärke * 2.0"
oStyle.CornerReliefShape = CornerReliefShapeEnum.kRoundCornerReliefShape
oStyle.CornerReliefSize = "Stärke * 4.0"
oStyle.MinimumRemnant = "Stärke * 2.0"
oPartA.Update()
Dim oContourFlanges As ContourFlangeFeatures = oSheetCompDef.Features.ContourFlangeFeatures
Dim oContourFlangeDef As ContourFlangeDefinition
oContourFlangeDef = oContourFlanges.CreateContourFlangeDefinition(oPathline)
Call oContourFlangeDef.SetDistanceExtent(13, PartFeatureExtentDirectionEnum.kPositiveExtentDirection)
Dim oContourFlange As ContourFlangeFeature = oContourFlanges.Add(oContourFlangeDef)
I got Error:
Wrong Parameter
Solved! Go to Solution.
Hi,
Inventor 2022
API. VB.NET Visual Studio
I try to Change SubType of a Part (From Part to SheetMetal) in Assembly Enviroment.
My Goal i to Create a CounterFlange
The Problem is to change the SubType Docuemnt.
I Think, the Problem is, that iam i SubAssembly, ActiveDocument is Probably the Main Assembly.
How i can make the PartDocuemnt Active in Assembly?
Is this the Problem ?
This is My Code:
Dim oArc As SketchArc
oArc = oSketchPart_A.SketchArcs.AddByCenterStartEndPoint(oPointCenterArc, oSketchLine_06.EndSketchPoint, oSketchLine_07.EndSketchPoint)
Dim oPathline As Path = oPart_A_Def.Features.CreatePath(oArc)
oOccAssembly_Middle.Edit()
'oOccPartA.Edit()
Dim oRefComponents As ReferenceComponents = oPart_A_Def.ReferenceComponents
g_inventorApplication.ActiveDocument.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
oPartA.Update()
Dim oSheetCompDef As SheetMetalComponentDefinition = oPartA.ComponentDefinition
Dim oSheetMetallFeatures As SheetMetalFeatures = oSheetCompDef.Features
Dim oStyle As SheetMetalStyle
oStyle = oSheetCompDef.SheetMetalStyles.Item(1)
oStyle.Thickness = "2"
oStyle.BendRadius = "Stärke"
oStyle.BendReliefDepth = "Stärke * 0.5"
oStyle.BendReliefShape = BendReliefShapeEnum.kRoundBendReliefShape
oStyle.BendReliefWidth = "Stärke"
oStyle.BendTransition = BendTransitionEnum.kArcBendTransition
oStyle.BendTransitionArcRadius = "Stärke * 2.0"
oStyle.CornerReliefShape = CornerReliefShapeEnum.kRoundCornerReliefShape
oStyle.CornerReliefSize = "Stärke * 4.0"
oStyle.MinimumRemnant = "Stärke * 2.0"
oPartA.Update()
Dim oContourFlanges As ContourFlangeFeatures = oSheetCompDef.Features.ContourFlangeFeatures
Dim oContourFlangeDef As ContourFlangeDefinition
oContourFlangeDef = oContourFlanges.CreateContourFlangeDefinition(oPathline)
Call oContourFlangeDef.SetDistanceExtent(13, PartFeatureExtentDirectionEnum.kPositiveExtentDirection)
Dim oContourFlange As ContourFlangeFeature = oContourFlanges.Add(oContourFlangeDef)
I got Error:
Wrong Parameter
Solved! Go to Solution.
Solved by JelteDeJong. Go to Solution.
This is how you can change a part of an assembly.
Dim doc As AssemblyDocument = ThisDoc.Document
' Get the part occurrence object
Dim oOccPartA = doc.ComponentDefinition.Occurrences.
Cast(Of ComponentOccurrence).
Where(Function(o) o._DisplayName = "PartA").
FirstOrDefault()
' Get the document that is refrenced by the occurrence
Dim partDoc As PartDocument = oOccPartA.ReferencedDocumentDescriptor.ReferencedDocument
' Change the sub type
partDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
This is how you can change a part of an assembly.
Dim doc As AssemblyDocument = ThisDoc.Document
' Get the part occurrence object
Dim oOccPartA = doc.ComponentDefinition.Occurrences.
Cast(Of ComponentOccurrence).
Where(Function(o) o._DisplayName = "PartA").
FirstOrDefault()
' Get the document that is refrenced by the occurrence
Dim partDoc As PartDocument = oOccPartA.ReferencedDocumentDescriptor.ReferencedDocument
' Change the sub type
partDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com
Hi @JelteDeJong ,
Thanks for Help
Thanks for Solution.
oPartA.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
🙂
Hi @JelteDeJong ,
Thanks for Help
Thanks for Solution.
oPartA.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}"
🙂
Can't find what you're looking for? Ask the community or share your knowledge.