Add planes and have formula (with parameters) in Equation of Plane.

Add planes and have formula (with parameters) in Equation of Plane.

J.VandeMerckt
Advocate Advocate
322 Views
2 Replies
Message 1 of 3

Add planes and have formula (with parameters) in Equation of Plane.

J.VandeMerckt
Advocate
Advocate

Hi Forum

I'm trying to add a plane to my model using Ilogic.
I want to offset the plane using the "pLength" parameter.
This formula should also stay in the parameter equation of the plane.

The Code i'm trying looks like this;

oDef = ThisDoc.Document.ComponentDefinition
Dim oWPlane As WorkPlane


oWPlane = oDef.WorkPlanes.AddByPlaneAndOffset(oDef.WorkPlanes("YZ Plane (Front)"), Parameter("-pLength")/2) 
oWPlane.Name = "YZ Plane (Mid)"

oWPlane = oDef.WorkPlanes.AddByPlaneAndOffset(oDef.WorkPlanes("YZ Plane (Front)"), Parameter("-pLength")) 
oWPlane.Name = "YZ Plane (Back)"


So Right now the formula pLength gets the wrong result.
But even if it was the correct result the equation just shows the result and not the formula.

Parameter in the end should look like this:

JVandeMerckt_0-1720517703277.png


Let me know if i wasn't clear.

Best regards

Justin

 

 

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

Stakin
Collaborator
Collaborator

 

oDef = ThisDoc.Document.ComponentDefinition
Dim oWPlane As WorkPlane


oWPlane = oDef.WorkPlanes.AddByPlaneAndOffset(oDef.WorkPlanes("YZ Plane (Front)"), (-1)*Parameter("pLength")/2) 
oWPlane.Name = "YZ Plane (Mid)"

oWPlane = oDef.WorkPlanes.AddByPlaneAndOffset(oDef.WorkPlanes("YZ Plane (Front)"), (-1)*Parameter("pLength")) 
oWPlane.Name = "YZ Plane (Back)"

 

Try this

Message 3 of 3

J.VandeMerckt
Advocate
Advocate
Accepted solution

Chat gpt helped me already.

oDef = ThisDoc.Document.ComponentDefinition
Dim pOffsetMidplane As String = "-pLength / 2"
Dim pOffsetBackplane As String = "-pLength"
Dim oWPlane As WorkPlane

oWPlane = oDef.WorkPlanes.AddByPlaneAndOffset(oDef.WorkPlanes("YZ Plane (Front)"), pOffsetMidplane) 
oWPlane.Name = "YZ Plane (Mid)"
oWPlane = oDef.WorkPlanes.AddByPlaneAndOffset(oDef.WorkPlanes("YZ Plane (Front)"), pOffsetBackplane) 
oWPlane.Name = "YZ Plane (Back)"  

 Didn't know you declare a formula as a string.
Ty for helping either way.