Specifying the spline CV method in a script

Specifying the spline CV method in a script

leeminardi
Mentor Mentor
1,484 Views
3 Replies
Message 1 of 4

Specifying the spline CV method in a script

leeminardi
Mentor
Mentor

I am writing a Maxscript program to import Max splines into AutoCAD via a script file.  The program creates a .scr file like the following.

 

 

(setvar 'osmode 0)
spline
0.0,0.0,0.0
5.0,0.0,0.0
5.0,10.0,0.0
0.0,10.0,0.0

 

 

Note that the file ends with two blank lines.

The script assumes that the CV method of spline construction is active.   If I cut and paste the above into the AutoCAD command prompt it works fine. However, if I execute the script file, AutoCAD assumes the active method is Fit points.  I've tried several variations of including an "m" and "cv" to force the control vertex method for the script but have not been successful. 

 

I tried:

 

 

spline m cv

 

 

but got the following.

 

 

Command: spline
Specify first point or [Object]: m
Point or option keyword required.
Specify first point or [Object]:

 

 

 

Any suggestions?  Thanks.

 

lee.minardi
0 Likes
Accepted solutions (1)
1,485 Views
3 Replies
Replies (3)
Message 2 of 4

ronjonp
Mentor
Mentor
Accepted solution

Maybe this ?

 

(setvar 'osmode 0)
(setvar 'splmethod 1)
spline
0.0,0.0,0.0
5.0,0.0,0.0
5.0,10.0,0.0
0.0,10.0,0.0

 

Or hodge podge after the spline is created:

 

(vla-put-splinemethod (vlax-ename->vla-object (entlast)) 1)

This appears to work:

 

(setvar 'osmode 0)
(initcommandversion)
spline m cv
0.0,0.0,0.0
5.0,0.0,0.0
5.0,10.0,0.0
0.0,10.0,0.0

 

0 Likes
Message 3 of 4

leeminardi
Mentor
Mentor

@ronjonp 

initcommandversion worked, setvar 'splmethid 1, did not.

 

Thank you.  I'm not familiar with initcommandversion .

 

Lee

lee.minardi
0 Likes
Message 4 of 4

ronjonp
Mentor
Mentor

Glad to help 🍻

0 Likes