Jump to content

node lisp stopped working. HELP


chelsea1307

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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