Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Edit dimension constraints in Controur Flange sketch

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Steffen_Hoerup
377 Views, 3 Replies

Edit dimension constraints in Controur Flange sketch

Steffen_Hoerup
Participant
Participant

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.

Inventor-CF Params.PNG

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?

0 Likes

Edit dimension constraints in Controur Flange sketch

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.

Inventor-CF Params.PNG

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?

Labels (2)
3 REPLIES 3
Message 2 of 4
Ralf_Krieg
in reply to: Steffen_Hoerup

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Try:

oSketch = oContourFlange.Definition.Path.Item(1).SketchEntity.Parent

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
0 Likes

Hello

 

Try:

oSketch = oContourFlange.Definition.Path.Item(1).SketchEntity.Parent

 


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
Message 3 of 4
Steffen_Hoerup
in reply to: Ralf_Krieg

Steffen_Hoerup
Participant
Participant

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

 

 

0 Likes

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

 

 

Message 4 of 4
Ralf_Krieg
in reply to: Steffen_Hoerup

Ralf_Krieg
Advisor
Advisor

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.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com
0 Likes

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.


R. Krieg
RKW Solutions GmbH
www.rkw-solutions.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report