News:

Interested in some really terrific mobile apps? Visit www.turboapps.com for details.

Main Menu

Create a 3D Spline by Fit Points

Started by Jacobusdt, August 19, 2014, 02:06:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jacobusdt

Hi Forum People

Can anybody help me to create a 3D Spline by fit points with Ruby or VBA please.

I have calculated values which I want to use as the vertices for the 3D Spline by fit points.

Thanks

Jacobusdt

nikkipollard

#1
I know this is a really old Topic but I found a solution. That works in vb.net and the macro recorder - it doesn't work in Ruby
So I thought I would post the solution in case anyone else has the same question.
Sdraw a spline by control points then change the spline calculations to by fit points using SetCurveByFitPoints method

For Ruby use SetCurveVertexAsFitPoints method



'VBA code
Dim gSpline As IMSIGX.IGraphic
      Set  gSpline = TcDraw.Graphics.AddCurveSpline(0, 0, 0)
        gSpline.Vertices.Add 1000, 520, 300
        gSpline.Vertices.Add 2000, -501, 780
        gSpline.SetCurveByFitPoints

Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Frederick Lm

TurboCAD Platinum 2021 64-bit

Andy H

Quote from: Frederick Lm on December 15, 2021, 07:06:06 AM
Where can I find VBA in TC 2021?

Simple answer.  You can't.

When VBA was removed way back somewhere around v10,  (I believe for financial reasons).  That was the last time VBA will ever be in TC.   One can use either, VB.net (part of MS visual studio).   Or. VBA when used inside anther program like MS Excel.  (Yep, you can 'usually' control TC from inside Excel developer tools).   Or.  Adapting for use in Ruby.   Or. The macro palette which uses a version of VB Script.   Or. Inside AnimationLab, which also uses a version of VB Script.  (I have not tested all the code in AL).

nikkipollard

#4
Frederick If you are looking for a way to draw a 3d spline by fit points in ruby
This works for me - you will want to adapt one of Kevins polyline or point scripts if you need to read from a file.

#3d spline

def draw3DSpline
tcApp = TCApplication
tcActDwg = tcApp.ActiveDrawing
tcActVw = tcActDwg.ActiveView
tcGrs = tcActDwg.Graphics
  tcGr = tcGrs.AddCurveSpline(0,0,0)   #add a new empty spline
 
grVerts = tcGr.Vertices
  grVerts.UseWorldCS = true
  grVerts.Add(12.5, 5.0, 2)
  grVerts.Add(12.5, 0.0, 5)
  grVerts.Add(24.5, -5.0, 3)
  grVerts.Add(24.5, 0.0, 0.0)
  tcGr.SetCurveVertexAsFitPoints

tcActVw.Refresh
  tcActVw = nil
  grVerts = nil
  tcGr = nil
  tcActDwg = nil
  tcApp = nil
end

draw3DSpline

#UI.menu("Plugins").add_item("TC Draw 3D Spline"){draw3DSpline}

Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h