chelsea1307 Posted May 28, 2009 Share Posted May 28, 2009 I use the code below to insert nodes with the numbers. usually you type pnode and the first node number and it inserts that node with the number and then it continues. For some reason its not working. Now im getting Enter node number2 layer ; error: no function definition: VPPROMPT Current layer: "waste" Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck /Unlock/stAte/Description/rEconcile]: m Enter name for new layer (becomes the current layer) : pnode Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck /Unlock/stAte/Description/rEconcile]: co New color [Truecolor/COlorbook] : 2 Enter name list of layer(s) for color 2 (yellow) : Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/MATerial/Plot/Freeze/Thaw/LOck /Unlock/stAte/Description/rEconcile]: Command: Enter isertion point insert ; error: no function definition: VPPROMPT Command: pnode Unknown command "PNODE". Press F1 for help. Command: Command: 48.000000 ( COMMAND "._DDINSERT") LISP command is not available. Command: 48.000000 *Cancel* any one know why or how to fix the problem? ;Written by Tom Cather (defun c:pnode() (setq sz (getvar "dimscale")) (setq num (getint "\nEnter node number" )) (setq rgn (getvar "regenmode")) (setvar "regenmode"0) (command "layer" "m" "pnode" "co" "2" "") (command "") (setvar "regenmode" rgn) (while num (setq pt1 (getpoint "\nEnter isertion point ")) (command "insert" "pnode" pt1 sz sz "0" num) (setq num (+ 1 num)) ) ) ;Written by Tom Cather (defun c:pnode2() (setq sz (getvar "dimscale")) (setq num (getint "\nEnter node number" )) (setq rgn (getvar "regenmode")) (setvar "regenmode"0) (command "layer" "m" "pnode" "co" "2" "") (command "") (setvar "regenmode" rgn) (while num (setq pt1 (getpoint "\nEnter isertion point ")) (command "insert" "pnode2" pt1 sz sz "0" num) (setq num (+ 1 num)) ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 28, 2009 Share Posted May 28, 2009 This would probably be a better way to write it: {untested} (defun c:pnode (/ *error vlst ovar num dm pt) (defun *error* (msg) (if ovar (mapcar 'setvar vlst ovar)) (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\n<< Error: " msg " >>"))) (princ)) (setq vlst '("CMDECHO" "ATTREQ") ovar (mapcar 'getvar vlst)) (mapcar 'setvar vlst '(0 1)) (if (and (setq num (getint "\nEnter Node Number: ")) (or (tblsearch "BLOCK" "PNODE") (findfile "PNODE.dwg"))) (progn (setq dm (max 1 (getvar 'DIMSCALE))) (or (tblsearch "LAYER" "PNODE") (vla-put-color (vla-add (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object))) "PNODE") 2)) (while (setq pt (getpoint "\nSpecify Insertion Point: ")) (command "_.-insert" "PNODE" "_non" pt1 dm dm "0.0" num) (setq num (1+ num)))) (princ "\n<!> Block Not Found or No Number Entered <!>")) (mapcar 'setvar vlst ovar) (princ)) Quote Link to comment Share on other sites More sharing options...
chelsea1307 Posted May 28, 2009 Author Share Posted May 28, 2009 It looks like its working except the block isnt getting inserted it keeps asking for points but doesnt insert the block. Ive attached the block too. PNODE.DWG Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 28, 2009 Share Posted May 28, 2009 Sorry, my mistake - I typed "pt1" instead of "pt"... stupid typo.... (defun c:pnode (/ *error vlst ovar num dm pt) (defun *error* (msg) (if ovar (mapcar 'setvar vlst ovar)) (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\n<< Error: " msg " >>"))) (princ)) (setq vlst '( "CMDECHO" "ATTREQ") ovar (mapcar 'getvar vlst)) (mapcar 'setvar vlst '(0 1)) (if (and (setq num (getint "\nEnter Node Number: ")) (or (tblsearch "BLOCK" "PNODE") (findfile "PNODE.dwg"))) (progn (setq dm (max 1 (getvar 'DIMSCALE))) (or (tblsearch "LAYER" "PNODE") (vla-put-color (vla-add (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object))) "PNODE") 2)) (while (setq pt (getpoint "\nSpecify Insertion Point: ")) (command "-insert" "PNODE" "_non" pt dm dm "0.0" num) (setq num (1+ num)))) (princ "\n<!> Block Not Found or No Number Entered <!>")) (mapcar 'setvar vlst ovar) (princ)) Quote Link to comment Share on other sites More sharing options...
chelsea1307 Posted May 28, 2009 Author Share Posted May 28, 2009 Like always, you got it to work perfectly. Thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 28, 2009 Share Posted May 28, 2009 Like always, you got it to work perfectly. Thanks Excellent, thanks Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted May 28, 2009 Share Posted May 28, 2009 Oops! I think I typed this one a bit too quick! Forgot to set the layer: (defun c:pnode (/ *error vlst ovar num dm pt) (defun *error* (msg) (if ovar (mapcar 'setvar vlst ovar)) (if (not (member msg '("Function cancelled" "quit / exit abort"))) (princ (strcat "\n<< Error: " msg " >>"))) (princ)) (setq vlst '("CLAYER" "CMDECHO" "ATTREQ") ovar (mapcar 'getvar vlst)) (mapcar 'setvar (cdr vlst) '(0 1)) (if (and (setq num (getint "\nEnter Node Number: ")) (or (tblsearch "BLOCK" "PNODE") (findfile "PNODE.dwg"))) (progn (setq dm (max 1 (getvar 'DIMSCALE))) (or (tblsearch "LAYER" "PNODE") (vla-put-color (vla-add (vla-get-layers (vla-get-ActiveDocument (vlax-get-acad-object))) "PNODE") 2)) [b][color=Red](setvar "CLAYER" "PNODE")[/color][/b] (while (setq pt (getpoint "\nSpecify Insertion Point: ")) (command "-insert" "PNODE" "_non" pt dm dm "0.0" num) (setq num (1+ num)))) (princ "\n<!> Block Not Found or No Number Entered <!>")) (mapcar 'setvar vlst ovar) (princ)) Quote Link to comment Share on other sites More sharing options...
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.