chiimayred Posted October 30, 2014 Posted October 30, 2014 (edited) 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 October 30, 2014 by chiimayred Quote
chiimayred Posted October 30, 2014 Author Posted October 30, 2014 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! Quote
marko_ribar Posted October 30, 2014 Posted October 30, 2014 Command: (rtos (atof "2.485834611853077E+005") 2 2) "248583.46" Quote
chiimayred Posted October 30, 2014 Author Posted October 30, 2014 Perfect! That helps me out with one of my issues Quote
BIGAL Posted October 31, 2014 Posted October 31, 2014 Your using a lot of reserved words point, pspsace for variable names not a good idea, this may be creating problems. Quote
chiimayred Posted October 31, 2014 Author Posted October 31, 2014 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 Quote
Recommended Posts
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.