Help Needed - AutoLISP revision cloud LISP routine

Help Needed - AutoLISP revision cloud LISP routine

patrick.phillipsT8ATG
Contributor Contributor
1,108 Views
6 Replies
Message 1 of 7

Help Needed - AutoLISP revision cloud LISP routine

patrick.phillipsT8ATG
Contributor
Contributor

Hey folks, I am writing a LISP routine to allow me to create a revision cloud and insert a revision triangle into a drawing, along with the ability to change the arc length of the revision cloud prior to creation. I have managed to make the revision cloud part work correctly, but when it gets to the revision triangle, I keep getting an invalid block name error. I know the block name is correct, as is the path to that block, but I keep hitting that roadblock.

 

Can anyone assist and tell me what I am doing wrong here?

 

(defun C:create_layer ()
  (command "._Layer" "_Make" "DAI-REVISION" "_Color" "4"
             "DAI-REVISION" "LT" "Continuous" "DAI-REVISION" "")
)
(c:create_layer)
(defun C:RVCLD (/ inp ) 
    (initget "Pline Rectangle") ; ask for input
  (setq Inp (getkword "\nWhat type of cloud would you like to draw? [Pline/Rectangle] <Pline>: "))
  (or Inp (setq Inp "Pline"))

(cond
((= inp "Pline")
(defun C:RVCP ()
  (command "_.PLINE")
  (while (= (getvar "CMDNAMES") "PLINE")
    (command pause)
  )
  (command "pedit" "l" "c" "")
  (command "revcloud" "a" pause "" "" "l" "no"))
  (C:RVCP)
)
((= inp "Rectangle")
(Defun C:RVCR ( / opt p1 p2 iph )
(setq p1(getpoint "\nPick first corner of window: "))
        (setq p2(getcorner p1 "\nOpposite corner: "))
        (setvar "plinewid" 0)
        (command "rectang" p1 p2)
(command "REVCLOUD" "a" pause "" "O" (entlast) "N"))
 (C:RVCR)
))
(defun C:INSTRI ()
  (command "-insert" "M:\19. ACADE\Support Files\Script Files and LISP Routines\RVCLD\01_RevTri.dwg" "s" pause pause "")
  (command "attedit" (entlast)))
  (c:INSTRI))

 

0 Likes
Accepted solutions (4)
1,109 Views
6 Replies
Replies (6)
Message 2 of 7

paullimapa
Mentor
Mentor
Accepted solution

you need to use double backslashes when use in lisp code like this:

(command "-insert" "M:\\19. ACADE\\Support Files\\Script Files and LISP Routines\\RVCLD\\01_RevTri.dwg" "s" pause pause "")

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 3 of 7

ec-cad
Collaborator
Collaborator
Accepted solution

Change \ to \\ in the following line.

(command "-insert" "M:\19. ACADE\Support Files\Script Files and LISP Routines\RVCLD\01_RevTri.dwg" "s" pause pause "")
0 Likes
Message 4 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

Or, single forward slashes:

"M:/19. ACADE/Support Files/Script Files and LISP Routines/RVCLD/01_RevTri"

And it's a small thing, but note that I omitted the .dwg filetype ending, which you don't need [it won't Insert any other kind of file]. 

Kent Cooper, AIA
0 Likes
Message 5 of 7

patrick.phillipsT8ATG
Contributor
Contributor

Great! The double slashes fixed the issue, but now I have another one.

After I do an APPLOAD and use the command RVCLD, the coding just... does nothing. I've done everything I can to fix this. There's no missing parentheses, no buggy language that I can tell. It just doesn't work.

Here's the updated code:

(defun C:CRTLAY ()
  (command "._Layer" "_Make" "DAI-REVISION" "_Color" "4"
             "DAI-REVISION" "LT" "Continuous" "DAI-REVISION" ""))
(C:CRTLAY)
(defun C:RVCLD (/ inp ) 
    (initget "Pline Rectangle") ; ask for input
  (setq Inp (getkword "\nWhat type of cloud would you like to draw? [Pline/Rectangle] <Pline>: "))
  (or Inp (setq Inp "Pline"))
)
(cond
((= inp "Pline")
(defun C:RVCP ()
  (command "_.PLINE")
  (while (= (getvar "CMDNAMES") "PLINE")
    (command pause)
  )
  (command "pedit" "l" "c" "")
  (command "revcloud" "a" pause "" "" "l" "no"))
  (C:RVCP)
)
((= inp "Rectangle")
(Defun C:RVCR ( / opt p1 p2 iph )
(setq p1(getpoint "\nPick first corner of window: "))
        (setq p2(getcorner p1 "\nOpposite corner: "))
        (setvar "plinewid" 0)
        (command "rectang" p1 p2)
(command "REVCLOUD" "a" pause "" "O" (entlast) "N"))
 (C:RVCR)
))
(C:RVCLD)
(defun C:INSTRI ()
  (command "-insert" "M:\\19. ACADE\\Support Files\\Script Files and LISP Routines\\RVCLD\\01_RevTri.dwg" "s" pause "" "")
  (command "attedit" "l"))
(C:INSTRI)
0 Likes
Message 6 of 7

Kent1Cooper
Consultant
Consultant
Accepted solution

I don't know whether this is your issue, but I would not call each command with those (C:whatever)s  immediately after defining it, all within one AutoLisp file.  The calling of earlier commands that ask for input would be awaiting that input before it goes on to the next definition.

Kent Cooper, AIA
0 Likes
Message 7 of 7

patrick.phillipsT8ATG
Contributor
Contributor

Thanks for all the help guys. I got it working now.

0 Likes