Splines

The VBA forum deals with IntelliCAD 2000 VBA (Visual Basic for Applications) issues.

Moderator: CMS Inc

Post Reply
tonyc
Newbie
Posts: 2
Joined: Tue Dec 19, 2006 12:01 am
Contact:

Splines

Post by tonyc » Wed Dec 20, 2006 9:08 am

If I create 3 or 4 points on the screen in a simple curve I can easily connect them with a spline curve using the mouse without specifying start and end tangents. However in VBA I tried:

Public Sub TestAddSpline()
Dim objEnt As IntelliCAD.Spline
Dim vecstart As New IntelliCAD.Vector
Dim vecend As New IntelliCAD.Vector
Dim db1Points As New IntelliCAD.Points
Dim fit1 As New IntelliCAD.Point
Dim fit2 As New IntelliCAD.Point
Dim fit3 As New IntelliCAD.Point

vecstart.x = -2: vecstart.y = -4: vecstart.z = 0
vecend.x = 4: vecend.y = 4: vecend.z = 0

fit1.x = 1: fit1.y = 1: fit1.z = 0
fit2.x = 3: fit2.y = 5: fit2.z = 0
fit3.x = 7: fit3.y = -5: fit3.z = 0

db1Points.Add 1, 1, 0, 0
db1Points.Add 7, 8, 0, 1
db1Points.Add 3, 5, 0, 2

Set objEnt = IntelliCAD.ActiveDocument.ModelSpace.AddSpline(db1Points, vecstart, vecend)
objEnt.Update
End Sub

But I get funny shapes: the program swaps the points around and I have to specify start and end vectors or it gives me an error message. How can one know the start and end vectors to get the smoothest curve? Should I give up trying to draw splines with VBA?
But to draw the spline on the screen, I have to make my userform hidden, but then I cannot react with VBA except through Intellicad events. Is it possible to have a button in the Intellicad menu to re-show my VBA form?

P.S. I am a VBA newby, but its a fantastic program
tonyc
Newbie
Posts: 2
Joined: Tue Dec 19, 2006 12:01 am
Contact:

Post by tonyc » Wed Dec 20, 2006 9:33 am

excuse me, the fit1 etc. points are a red herring, left over from an early attempt
Tony
Post Reply