Change equation curve values

<?xml encoding=”UTF-8″>By Adam Nagy

The equation curve values are fully accessible from the API and can be changed as well. One thing that can be difficult to spot, unless you read the API Help Reference carefully, is that the parameters for GetEquation and SetEquation are not the same. So if you try to use the same parameters then SetEquation will fail.

The difference is in the MinValue and MaxValue. In GetEquation they are Parameter, but in SetEquation they are a Variant which should either be a numeric value or a string.

This is how I can change the X value from “136t” to “136+13.325t^2″ 

Sub ModifyEquationCurve()
Dim doc As PartDocument
Set doc = ThisApplication.ActiveDocument
Dim s3d As Sketch3D
Set s3d = doc.ComponentDefinition.Sketches3D(1)
Dim sec As SketchEquationCurve3D
Set sec = s3d.SketchEquationCurves3D(1)
Call s3d.Edit
Dim x As String, y As String, z As String
Dim cst As CoordinateSystemTypeEnum
Dim min As Parameter, max As Parameter
Dim mins As String, maxs As String
Call sec.GetEquation(cst, x, y, z, min, max)
mins = min.Expression
maxs = max.Expression
x = "136+13.625*t^2"
Call sec.SetEquation(cst, x, y, z, mins, maxs)
Call s3d.ExitEdit
End Sub

Equationcurve

 


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading