What is StartTangentScale and how to use it in API

What is StartTangentScale and how to use it in API

liminma8458
Collaborator Collaborator
888 Views
6 Replies
Message 1 of 7

What is StartTangentScale and how to use it in API

liminma8458
Collaborator
Collaborator

Hi,

I have a 3D sketch spline as below. I want to make the tangent handle a little bit shorter so the slope will be different. I can change the scale (length) of tangent line manually. But how can I control it through API? I find an API of SketchSpline3D.StartTangentScale Property as in the third picture. It indicates that the property is able to "gets and sets" then later claims  "read only". I am confused. Is this parameter controlling the length of tangent line? is there any code snippet to show how to do it?

 

Capture_shape1.PNG

Capture_shape2.PNG

 

Capture_shot3.PNG

 

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 Likes
Accepted solutions (1)
889 Views
6 Replies
Replies (6)
Message 2 of 7

YuhanZhang
Autodesk
Autodesk
Accepted solution

Hi Limin,

 

To change the 3D spline handle you can try below VBA code, make sure you new a part with a 3D Sketch and an interpolation spline in it before running the code:

 

Sub ChangeFitPointHandle()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSK3d As Sketch3D
    Set oSK3d = oDoc.ComponentDefinition.Sketches3D(1)
    
    Dim oSpline3d As SketchSpline3D
    Set oSpline3d = oSK3d.SketchSplines3D(1)
    
    Dim oFP As SketchPoint3D
    Set oFP = oSpline3d.FitPoint(1)
    oDoc.SelectSet.Select oFP
    
    ' make sure to enable the handle
    Call oSpline3d.SetHandleStatus(oFP, True)
    
    Dim oHandle As SketchSplineHandle3D
    Set oHandle = oSpline3d.GetHandle(oFP)
    
    Dim dX As Double, dY As Double, dZ As Double
    dX = (oHandle.StartSketchPoint.Geometry.X - oHandle.EndSketchPoint.Geometry.X) / 10
    dY = (oHandle.StartSketchPoint.Geometry.Y - oHandle.EndSketchPoint.Geometry.Y) / 10
    dZ = (oHandle.StartSketchPoint.Geometry.Z - oHandle.EndSketchPoint.Geometry.Z) / 10
    
    Dim oVector As Vector
    Set oVector = ThisApplication.TransientGeometry.CreateVector(dX, dY, dZ)
    
    ' shrink the handle
    oDoc.SelectSet.Select oHandle
    oHandle.EndSketchPoint.MoveBy oVector
    
End Sub


If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 7

liminma8458
Collaborator
Collaborator

Great! It works!

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 Likes
Message 4 of 7

liminma8458
Collaborator
Collaborator

Hi, Zhang,

Just want to know whether something extra is possible: as in "oHandle.EndSketchPoint.MoveBy oVector", EndSketchPoint will be moved by oVector; but at the same time, StartSketchPoint will also move symmetrically, so the spline curvature on the side of StartSketchPoint will also change, so as this portion of spline. Is it possible to only move the EndSketchPoint, while StartSketchPoint stays at same location and the spline curvature will not change at this portion? (so the EndSketchPoint and StartSketchPoint will not be symmetrical any more referring to the center sketch point.)

Capture_shape3.PNG

Thanks
Limin
Inventor pro 2023 64 bit update 5.3; Windows 11 pro 64 bit version 24H2; Office 2013 64 bit

Download iCable in App Store to Create Cables Easily

0 Likes
Message 5 of 7

YuhanZhang
Autodesk
Autodesk

Hi Limin,

 

This is as designed that the handle's two ends are symmetric according to the fit point on Bspline curve. Both UI and API now can only allow you to move the two ends of the handle symmetrically. 

 

Hope this clears.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes
Message 6 of 7

Stakin
Collaborator
Collaborator

Is there a way to move the sketchspline3d curve which is defined by BSplineCurve?

If no way,is there  are some course about BSpline?

Recently,I struggled about extract the central axis of the BsplineSuface tube,
it need to manipulate the BSpline of it,I tried to get the Bsplinecurve data and info, and  to recreate a new Bspline curve at the central of tube by transform the these origin data obtained from Bsplinecurve.
But First I cann't use the GetBSplineData and GetBSplineInfo method,when I run the code, it throw out a InteropServices.COMException (0x80020005) exception.
Second ,I want to know the data structure of the Bspline,Is there some reference about the BSpline?
Hope your reply.
thanks.
0 Likes
Message 7 of 7

YuhanZhang
Autodesk
Autodesk

 Can you provide a simple and non-confidential data and code, and tell what you want to do with them, we can see if we can make it work here?



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

0 Likes