I have an already created Contour Flange as shown below. I would like to verify if the sketch is Fully constraned, and perhaps update the two dimension constraints in the sketch.
I just can't figure out how to hind the sketch.
With the Face Feature in Sheet Metal I can find the sketch in this way:
Private ReadOnly invApp As Inventor.Application = GetObject(, "Inventor.Application")
Dim oDoc As Document = invApp.ActiveDocument
Private Sub GetSketch()
Dim oPartDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oUserParams As UserParameters = oPartDef.Parameters.UserParameters
Dim oSketch As Sketch = Nothing
If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oSMCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
If Not oSMCompDef.Thickness.Expression = "thickness" Then
oUserParams.Item("thickness").Expression = oSMCompDef.Thickness.Expression
oSMCompDef.Thickness.Expression = "thickness"
End If
Dim oSheetMetalFeatures As SheetMetalFeatures = oSMCompDef.Features
Dim oFace As FaceFeature = oSheetMetalFeatures.FaceFeatures.Item(1)
oSketch = oFace.Definition.Profile.Parent
End If
End Sub
For the Contour Flange I guessed the Path-object where similar the the Profile-object in Face/Extrude. So I tried this:
Private ReadOnly invApp As Inventor.Application = GetObject(, "Inventor.Application")
Dim oDoc As Document = invApp.ActiveDocument
Dim oPartDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oUserParams As UserParameters = oPartDef.Parameters.UserParameters
Dim oSketch As Sketch = Nothing
Private Sub ContourFlangeSketch()
If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oSMCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
If Not oSMCompDef.Thickness.Expression = "thickness" Then
oUserParams.Item("thickness").Expression = oSMCompDef.Thickness.Expression
oSMCompDef.Thickness.Expression = "thickness"
End If
Dim oSheetMetalFeatures As SheetMetalFeatures = oSMCompDef.Features
Dim oContourFlange As ContourFlangeFeature = oSheetMetalFeatures.ContourFlangeFeatures.Item(1)
'Below line does not work - It leads back to Contour Flange1:
oSketch = oContourFlange.Definition.Path.Item(1).Parent
'The following loop finds all the Model parameters by name, but not where they are used.
For i = 1 To oContourFlange.Parameters.Count
MsgBox(oContourFlange.Parameters.Item(i).Name) 'Feature parameters
Next
End If
End Sub
I have tried modifying above sample to see if the sketch could be found in oCountourFlange."Something"."Sub-Something". But no Success.
To be able to use the same routine for Extrude, Face, Revolve etc. i need to define oSketch, so I can Call a subroutine:
Call UpdateDimensions(oSketch)
I am therefore not keen on using the oContourFlange.Parameters.Item("d0").Expression method
Anyone can give a clue of how to define oSketch for Contour flanges?
Solved! Go to Solution.
I have an already created Contour Flange as shown below. I would like to verify if the sketch is Fully constraned, and perhaps update the two dimension constraints in the sketch.
I just can't figure out how to hind the sketch.
With the Face Feature in Sheet Metal I can find the sketch in this way:
Private ReadOnly invApp As Inventor.Application = GetObject(, "Inventor.Application")
Dim oDoc As Document = invApp.ActiveDocument
Private Sub GetSketch()
Dim oPartDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oUserParams As UserParameters = oPartDef.Parameters.UserParameters
Dim oSketch As Sketch = Nothing
If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oSMCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
If Not oSMCompDef.Thickness.Expression = "thickness" Then
oUserParams.Item("thickness").Expression = oSMCompDef.Thickness.Expression
oSMCompDef.Thickness.Expression = "thickness"
End If
Dim oSheetMetalFeatures As SheetMetalFeatures = oSMCompDef.Features
Dim oFace As FaceFeature = oSheetMetalFeatures.FaceFeatures.Item(1)
oSketch = oFace.Definition.Profile.Parent
End If
End Sub
For the Contour Flange I guessed the Path-object where similar the the Profile-object in Face/Extrude. So I tried this:
Private ReadOnly invApp As Inventor.Application = GetObject(, "Inventor.Application")
Dim oDoc As Document = invApp.ActiveDocument
Dim oPartDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oUserParams As UserParameters = oPartDef.Parameters.UserParameters
Dim oSketch As Sketch = Nothing
Private Sub ContourFlangeSketch()
If oDoc.DocumentSubType.DocumentSubTypeID = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
Dim oSMCompDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition
If Not oSMCompDef.Thickness.Expression = "thickness" Then
oUserParams.Item("thickness").Expression = oSMCompDef.Thickness.Expression
oSMCompDef.Thickness.Expression = "thickness"
End If
Dim oSheetMetalFeatures As SheetMetalFeatures = oSMCompDef.Features
Dim oContourFlange As ContourFlangeFeature = oSheetMetalFeatures.ContourFlangeFeatures.Item(1)
'Below line does not work - It leads back to Contour Flange1:
oSketch = oContourFlange.Definition.Path.Item(1).Parent
'The following loop finds all the Model parameters by name, but not where they are used.
For i = 1 To oContourFlange.Parameters.Count
MsgBox(oContourFlange.Parameters.Item(i).Name) 'Feature parameters
Next
End If
End Sub
I have tried modifying above sample to see if the sketch could be found in oCountourFlange."Something"."Sub-Something". But no Success.
To be able to use the same routine for Extrude, Face, Revolve etc. i need to define oSketch, so I can Call a subroutine:
Call UpdateDimensions(oSketch)
I am therefore not keen on using the oContourFlange.Parameters.Item("d0").Expression method
Anyone can give a clue of how to define oSketch for Contour flanges?
Solved! Go to Solution.
Solved by Ralf_Krieg. Go to Solution.
Hello
Try:
oSketch = oContourFlange.Definition.Path.Item(1).SketchEntity.Parent
Hello
Try:
oSketch = oContourFlange.Definition.Path.Item(1).SketchEntity.Parent
That did the trick, thank you.
So Path is just a shape, that does not relate to the sketch - it just get the information from the lines (sketchEntity)?
It makes sense that the lines parents must be the sketch.
Path object:
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-D17A4244-B04F-42CD-9935-BA2B07FD903E
Sketch Entity:
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-DEAE805D-E81F-4F71-AD23-8486C335F5F3
That did the trick, thank you.
So Path is just a shape, that does not relate to the sketch - it just get the information from the lines (sketchEntity)?
It makes sense that the lines parents must be the sketch.
Path object:
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-D17A4244-B04F-42CD-9935-BA2B07FD903E
Sketch Entity:
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-DEAE805D-E81F-4F71-AD23-8486C335F5F3
Hello
I don't know how this works internal. But a path can also base on one or more Edges instead of SketchLines. Maybe the Path is just a "MetaObject" to present the ContourFlangeFeature always the same type object to create the shape.
Hello
I don't know how this works internal. But a path can also base on one or more Edges instead of SketchLines. Maybe the Path is just a "MetaObject" to present the ContourFlangeFeature always the same type object to create the shape.
Can't find what you're looking for? Ask the community or share your knowledge.