Jump to content
chiimayred

Working Point Lisp

Recommended Posts

chiimayred

Hey guys,

 

I'm trying to make a lisp where the user would pick a point in the model and the lisp would create a multileader in paperspace with the coordinates pulled from the model.

 

Here's the code I got so far:

 

 (defun c:test (/ WorkingPoint Easting Northing Point)
 (command
   "_.mspace"
   );;end command
 (setq WorkingPoint (getpoint "\nWhere is Working Point?: "))
 (setq Northing (cadr WorkingPoint));;set "y" value of WorkingPoint to Northing
 (setq Easting (car WorkingPoint));;set "x" value of WorkingPoint to Easting
 (command
   "_.point" WorkingPoint
   );;end command
 (setq point (entlast));;set the workingpoint to point
 (command
   "_.chspace" point "" ""
   );;end command
 (setq pspaceworkingpoint (entget point))
 (setq mleaderinspt (list (car pspaceworkingpoint)(cadr pspaceworkingpoint)))
 (princ mleadinspt)
 );;end defun

 

Whenever I run this, for the "mleaderinspt" variable I get

 

nilnil

 

What I want to do is create the multileader insert point where the user picked the original working point but I'm having a hard time translating that to the paperspace.

 

Please note I haven't added error checking yet as this is still in the developmental phase/proof of concept.

 

Any and all help is appreciated.

 

Thanks!

 

EDIT: Think I figured it out, I'll update this thread if it works.

Edited by chiimayred

Share this post


Link to post
Share on other sites
chiimayred

Ok so here is where I'm at:

 

(defun c:test (/ WorkingPoint Easting Northing Point)
 (command
   "_.mspace"
   );;end command
 (setq WorkingPoint (getpoint "\nWhere is Working Point?: "))
 (setq Northing (cadr WorkingPoint));;set "y" value of WorkingPoint to Northing
 (setq Easting (car WorkingPoint));;set "x" value of WorkingPoint to Easting
 (command
   "_.point" WorkingPoint
   );;end command
 (setq point (entlast));;set the workingpoint to point
 (command
   "_.chspace" point "" ""
   );;end command
 (setq pspacepoint (entget point))
 (setq pspace (cdr (assoc 10 pspacepoint)))
 (command
   "_.mleader" pspace "@10,-10" "WORKING POINT N "
   )
 );;end defun

 

I'm having a problem getting the multileader to input the text... the typical format we use is:

 

WORKING POINT

N: XXXXX

E: XXXXX

 

I don't know how to get it to display like this... thoughts? I tried to use "strcat" but it won't accept integers from my research.

 

Also the coordinates that do come out, come out something like this "2.485834611853077E+005" and I just need it to be "248583.46", any ideas on how to remedy this as well?

 

Thanks!

Share this post


Link to post
Share on other sites
marko_ribar
Command: (rtos (atof "2.485834611853077E+005") 2 2)
"248583.46"

Share this post


Link to post
Share on other sites
chiimayred

Perfect! That helps me out with one of my issues

Share this post


Link to post
Share on other sites
BIGAL

Your using a lot of reserved words point, pspsace for variable names not a good idea, this may be creating problems.

Share this post


Link to post
Share on other sites
chiimayred

I figured something out that'll work for now, the formatting is a little off but the user can fix it (and will probably need to to name the working point) by editing the leader.

 

(defun c:test (/ WorkingPoint Easting Northing Point PSPACEPOINT PSPACE TEXT TEXTPROPS COORD)
   (command
   "_.mspace"
   );;end command
 (setq WorkingPoint (getpoint "\nWhere is Working Point?: "))
 (setq Northing (rtos (cadr WorkingPoint) 2 1));;set "y" value of WorkingPoint to Northing
 (setq Easting (rtos (car WorkingPoint) 2 1));;set "x" value of WorkingPoint to Easting
 (command
   "_.point" WorkingPoint
   );;end command
 (setq point (entlast));;set the workingpoint to point
 (command
   "_.chspace" point "" "";;this brings the workingpoint set in the modelspace to paperspace
   );;end command
 (setq pspacepoint (entget point));;get the properties for point
 (setq pspace (cdr (assoc 10 pspacepoint)));;find the x&y coords and set to pspace
 (COMMAND
   "mTEXT" PSPACE "@20,-20" "WORKING POINT" "N:"NORTHING "E:"EASTING ""
   );;END COMMAND
    (setq text (entlast));;set mtext to variable text
    (setq textprops (entget text));;get the properties from text
    (setq coord (cdr (assoc 1 textprops)));;find the string properties and set to coord
    (command
   "_.mleader" pspace "@10,-10" coord
   "_.erase" point text ""
   );;END COMMAND
 );;end defun

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...