Create custom parameters with mm^2 as a unit

Create custom parameters with mm^2 as a unit

STECORO
Participant Participant
684 Views
2 Replies
Message 1 of 3

Create custom parameters with mm^2 as a unit

STECORO
Participant
Participant

Hello community!

I was trying to create a new custom parameter without having it in the parameter list.

I would like to set the area as a unit with mm^2, but I only found Circular_mill.

 

I found this logic, but it sets text as a unit because of ‘UnitsTypeEnum.kTextUnits’.

 

Can anyone help me to set mm^2 as a unit within ilogic?

 

Thanks in advance.

Regards

 

Dim oParams As Parameters
Dim oPartDoc As PartDocument = ThisDoc.Document
Dim oPartCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
oParams = oPartCompDef.Parameters

Dim oUserParams As UserParameters = oParams.UserParameters

Try
  p = Parameter("PAINTED_AREA")
Catch
  oUserParams.AddByValue("PAINTED_AREA","MyValue", UnitsTypeEnum.kTextUnits)
End Try 

 

0 Likes
Accepted solutions (1)
685 Views
2 Replies
Replies (2)
Message 2 of 3

daltonNYAW9
Advocate
Advocate
Accepted solution

This is how you add squared units:

oUserParams.AddByValue("PAINTED_AREA", 1, "mm^2")

 

Are you using inventor 2024+? It added the "Finish" functionality that automatically makes a parameter for the painted area

daltonNYAW9_0-1729171803781.png

 

Message 3 of 3

STECORO
Participant
Participant

Hi @daltonNYAW9 , thanks for the reply.
Yes, we are using the 2024, but we have created a rule that works differently to the finishing functionality, working with the multi-body it is quite difficult to detect the perimeter painted area, so we worked to detect the interference between the bodies and so on.


Thanks again for your help.


Best regards
Stefano

 

0 Likes