Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
STECORO
173 Views, 2 Replies

Create custom parameters with mm^2 as a unit

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 

 

daltonNYAW9
in reply to: STECORO

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

 

STECORO
in reply to: daltonNYAW9

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