Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

CATIA MACRO: Formula using Parameters.GetNameToUseInRelation() and arithmetic operations

Status
Not open for further replies.

DiaeArrahmane

Automotive
Apr 4, 2024
17
0
0
FR
Hello, I am trying to create a formula using this line:
Set Formula = part.Relations.CreateFormula("X(Central_Cpt)", "", CentralCpt.x, Parameters.GetNameToUseInRelation(RX) & "-" & Parameters.GetNameToUseInRelation(dxCI) & "-20")
when RX = 10 and dxCI = 5, the result is not 10-5-20=-15, rather, it's 10-205=-195
Any idea how can I fix it?
& "-" & "20") has also the same result.
 
Replies continue below

Recommended for you

How are your parameters defined, what units/dimensions do you have?
You are creating a string defining the KWA input, as if you were manually using the Formula editor e.g.:

Dim String1 As String
String1 = "ToString(round(" & Part.Parameters.GetNameToUseInRelation(CentralCpt) & "->coord(1)*1000," & """m""" & ",0))"


regards,
LWolf
 
Status
Not open for further replies.
Back
Top