Revision cloud in specifik layer and start of Rectangular mode. Lisp

Revision cloud in specifik layer and start of Rectangular mode. Lisp

elfert
Contributor Contributor
927 Views
5 Replies
Message 1 of 6

Revision cloud in specifik layer and start of Rectangular mode. Lisp

elfert
Contributor
Contributor

I can't make the list change to Rectangular mode, whats wrong?

 

;revpaper makes layer AM_8 and starts revision cloud. 
(defun c:revpaper ( / oldcmdecho oldosnap)
;;Getting current osmode
(setq oldosnap (getvar "osmode"))
;;setting osmode zero
(setvar "OSMODE" 0)
;;setting cmdecho zero
(setvar "cmdecho" 0)
;;Checking if layer AM8 excist in not it will be created. switching to paper mode.
(if (not (tblsearch "LAYER" "AM_8"))
(Command "-layer" "n" "AM_8" "c" "1" "AM_8" "s" "AM_8" "P" "P" "AM_8" "s" "AM_8" "")
(setvar "clayer" "AM_8"))
(princ "Layer 'AM_8' is done")
(command "-layer" "s" "AM_8" "")
(command "_tilemode" "0")
;;starting the loop
(initget 1)
(command "revcloud" "Rectangular" "")
(setvar "cmdecho" 1) ;;setting cmdecho one
)

Please help!

 

0 Likes
928 Views
5 Replies
Replies (5)
Message 2 of 6

Ranjit_Singh
Advisor
Advisor

Looks like this will help (initcommandversion 2) Place it right before calling revcloud. See this link here

0 Likes
Message 3 of 6

elfert
Contributor
Contributor

That worked! THX. The code is looking like this:

 

;revpaper makes layer AM_8 and starts revision cloud. 
(defun c:revpaper ( / oldcmdecho oldosnap)
;;Getting current osmode
(setq oldosnap (getvar "osmode"))
;;setting osmode zero
(setvar "OSMODE" 0)
;;setting cmdecho zero
(setvar "cmdecho" 0)
;;Checking if layer AM8 excist in not it will be created. switching to paper mode.
(if (not (tblsearch "LAYER" "AM_8"))
(Command "-layer" "n" "AM_8" "c" "1" "AM_8" "s" "AM_8" "P" "P" "AM_8" "s" "AM_8" "")
(setvar "clayer" "AM_8"))
(princ "Layer 'AM_8' is done")
(command "-layer" "s" "AM_8" "")
(command "_tilemode" "0")
;;starting the loop
(initcommandversion 2)
(command "revcloud" "R")
(setvar "cmdecho" 1) ;;setting cmdecho one
)

 

 

Another thing is that i can't make it change to Layer AM_8 the first time after a AutoCAD restart.

0 Likes
Message 4 of 6

Kent1Cooper
Consultant
Consultant

@elfert wrote:

.... 

....
(if (not (tblsearch "LAYER" "AM_8"))
(Command "-layer" "n" "AM_8" "c" "1" "AM_8" "s" "AM_8" "P" "P" "AM_8" "s" "AM_8" "")
(setvar "clayer" "AM_8"))
(princ "Layer 'AM_8' is done")
(command "-layer" "s" "AM_8" "")
....

 

Another thing is that i can't make it change to Layer AM_8 the first time after a AutoCAD restart.


I don't understand why that last sentence should be happening, since you not only create it if it doesn't exist, or set it current if it does, but you have belt-and-suspenders multiple redundant settings of it as the current Layer.  How are you applying this after restarting AutoCAD?

 

Whatever is causing that problem, this may not fix it, but just a suggestion --  It's really not necessary to check whether a Layer exists in this situation.  The Make option will create it and set it current if it doesn't exist, and will set it current if it does.  And since it will immediately be current, it will be the default Layer for assigning the color and plot status, so you can just put in an Enter [""] to accept that default, and don't need to repeat spelling out the Layer name.  All the quoted code above can be replaced by simply:

 

(command "_.layer" "_make" "AM_8" "c" "1" "" "P" "P" "" "")
(princ "Layer 'AM_8' is done")

 

The only reason I can think of not to do it that way is if you might already have that Layer with a different color or plot status than the standard, and you want to leave those characteristics non-standard, because the above will force the standard color and plot status on that Layer if they're different.

Kent Cooper, AIA
0 Likes
Message 5 of 6

elfert
Contributor
Contributor

Some of it work, but Not the layer change the first time you fire it up it dosen't work.

 

;revpaper makes layer AM_8 and starts revision cloud. 
(defun c:revpaper ( / oldcmdecho oldosnap)
;;Getting current osmode
(setq oldosnap (getvar "osmode"))
;;setting osmode zero
(setvar "OSMODE" 0)
;;setting cmdecho zero
(setvar "cmdecho" 0)
;;making the layer AM_8 
(command "_.layer" "_make" "AM_8" "c" "1" "" "P" "P" "" "")
(princ "Layer 'AM_8' is done")
;;switching to paper mode.
(command "_tilemode" "0")
;;starting the loop
(initcommandversion 2)
(command "revcloud" "R")
(setvar "cmdecho" 1) ;;setting cmdecho one
)

 

If any got any suggestions....

 

 

thx in advance.

0 Likes
Message 6 of 6

Kent1Cooper
Consultant
Consultant

@elfert wrote:

Some of it work, but Not the layer change the first time you fire it up it dosen't work.  ....


It works for me, the first time.  Do you have a redefined Revcloud command that changes the Layer?  [Actually, I assume that's not the problem, because then it shouldn't work after the first time, either.]  Or one that saves the current Layer when you start, and sets it back afterwards?  If that's the problem, the Revcloud it draws should be on the right Layer, even if that's no longer current after you're done.  [But again, presumably that wouldn't work any differently after the first time.]  Does it "report" correctly about the Layer?  Does it make the Layer but not draw the Revcloud on it?

Kent Cooper, AIA
0 Likes