Jump to content

spline lisp


drafting_man

Recommended Posts

hi guyes

i wish anybody can help me

i'm searching for lisp make spline at the end point of lines that i selected .

Link to comment
Share on other sites

I don't understand the question. Make a spline at the end point of a line? Do you mean create a spline between the endpoints of two or more lines?

Link to comment
Share on other sites

firest thank's mr remark for your reply

what i mean i have many lines and i want to create spline from the end point of each line like this image

5952222.JPG

Link to comment
Share on other sites

I don't know of a lisp routine that will do what you want. My advice would be to do an Internet search for lisp routines that involve splines. Example:

 

"autocad"+"lisp"+"spline"

 

I know that Cadalyst magazine has a section of their website called Cad Tips where various CAD users have posted their own lisp routines. There are other websites that also post custom lisp routines.

 

We have a handful of people here who also have created custom routines for themselves and at the request of other forum members. Perhaps one of them will see your thread and respond in due time. Remember, we all volunteer our time and expertise so please be patient. Sometimes an answer does not come as quickly as we may want. OK?

Link to comment
Share on other sites

Fun quickie, now back to watching He-Man with my little girl...

(defun c:SPLC (/ ss lst)
 ;; Spline Connect
 ;; Alan J. Thompson, 05.15.10
 (vl-load-com)
 (if (setq ss (ssget '((0 . "LINE"))))
   (progn
     (vl-cmdf "_.spline")
     (foreach p (vl-sort
                  ((lambda (i)
                     (while (setq e (ssname ss (setq i (1+ i))))
                       (setq lst
                              (cons
                                (car
                                  (vl-sort (list (vlax-curve-getStartPoint e) (vlax-curve-getEndPoint e))
                                           (function (lambda (a b) (> (cadr a) (cadr b))))
                                  )
                                )
                                lst
                              )
                       )
                     )
                   )
                    -1
                  )
                  (function (lambda (a b) (< (car a) (car b))))
                )
       (vl-cmdf "_non" [color=Red](trans p 0 1)[/color])
     )
     (vl-cmdf "" "" "")
   )
 )
 (princ)
)

splc.gif

Link to comment
Share on other sites

Ask...and ye shall receive.

 

Where else can you get service like this?

 

You know what it is don't you? Priceless.

Link to comment
Share on other sites

Code updated to account for non-WCS (completely forgot).

 

alanjt Thanks

You're welcome. Enjoy.

 

Ask...and ye shall receive.

 

Where else can you get service like this?

 

You know what it is don't you? Priceless.

:)

Link to comment
Share on other sites

alanjt

Thanks for update

in this case there is a request to keep the origen and post the update in a new post. Thats for the beginner (same as me) to learn how to avoid the commets.

 

Thanks again

Link to comment
Share on other sites

wow alanjt u did it that what i want

than;'s man u are genius

:) You're welcome and enjoy.

 

alanjt

Thanks for update

in this case there is a request to keep the origen and post the update in a new post. Thats for the beginner (same as me) to learn how to avoid the commets.

 

Thanks again

Good point. I marked the updated portion in red.

 

Trans information:

 

trans

(trans pt from to [disp])

Arguments

pt A list of three reals that can be interpreted as either a 3D

point or a 3D displacement (vector).

from An integer code, entity name, or 3D extrusion vector

identifying the coordinate system in which pt is

expressed. The integer code can be one of the following:

0 World (WCS)

1 User (current UCS)

2 If used with code 0 or 1, this indicates the Display

Coordinate System (DCS) of the current viewport. When

used with code 3, it indicates the DCS of the current

model space viewport.

3 Paper space DCS (used only with code 2)

to An integer code, entity name, or 3D extrusion vector

identifying the coordinate system of the returned point.

See the from argument for a list of valid integer codes.

disp If present and is not nil, this argument specifies that pt is

to be treated as a 3D displacement rather than as a point.

If you use an entity name for the from or to arguments, it must be passed in

the format returned by the entnext, entlast, entsel, nentsel, and ssname

functions. This format lets you translate a point to and from the Object Coordinate

System (OCS) of a particular object. (For some objects, the OCS is

equivalent to the WCS; for these objects, conversion between OCS and WCS

is a null operation.) A 3D extrusion vector (a list of three reals) is another

method of converting to and from an object’s OCS. However, this does not

work for those objects whose OCS is equivalent to the WCS.

Link to comment
Share on other sites

Is the update

 (vl-cmdf "_non"(trans p 0 1))

insteat of

(vl-cmdf "_non" p)

Isnt it

 

What I am thinking about is?

 

 
;(vl-cmdf "_non" p) for non UCS
(vl-cmdf "_non" (trans p 0 1)) ;update

 

The deference between the 2 versions is clear.

Link to comment
Share on other sites

Correct, the only change. :) Since I was using command for spline, I had to convert the points return with vlax-curve-* from wcs to ucs.

Link to comment
Share on other sites

alanjt

not only the change

but post whole code again and remark the change with deference color or copy the same line and add ; next to the line

 

for example this is a part of the first post

                      )
                   )
                    -1
                  )
                  (function (lambda (a b) (< (car a) (car b))))
                )
       (vl-cmdf "_non" p)
     )
     (vl-cmdf "" "" "")
   )

 

and for second post (or updated)

                      )
                   )
                    -1
                  )
                  (function (lambda (a b) (< (car a) (car b))))
                )
       (vl-cmdf "_non" [color=red](trans p 0 1)[/color])
     )
     (vl-cmdf "" "" "")
   )

Link to comment
Share on other sites

or

                      )
                   )
                    -1
                  )
                  (function (lambda (a b) (< (car a) (car b))))
                )
       ;(vl-cmdf "_non" p) 
       (vl-cmdf "_non" [color=red](trans p 0 1)[/color]) ; updated to avoid UCS
     )
     (vl-cmdf "" "" "")
   )

Link to comment
Share on other sites

  • 5 years later...
...and stolen I mean copied here.

 

I assume that "Greate" is an alien language that I am unfamiliar with. In the case, however, that this is English, you might want to update the post title.

o:)

 

 

**Edit**

Thank you for posting it, btw. These blog posts are the type of things that originally helped me get into writing LISP code.

Edited by benhubel
Added comment
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...