AQucsaiJr Posted September 21, 2009 Share Posted September 21, 2009 I found a simple cloud lisp command that Fixo posted that drew a rectangle and then converted it to a cloud. Can this same basic lisp be adjusted to use a PLINE rather than a rectangle? ; Library pr.# ; written by Fatty T.O.H. (c)2005 ; all rights removed (defun C:CLD (/ aleng p1 p2 ) (setq p1 (getpoint "\nPick firs corner of rectangle: \n") p2 (getcorner p1 "\nPick opposite corner: \n") aleng (getdist "\nEnter arc length for cloud : ")) (command "_.rectangle" p1 p2) (command "_.revcloud" "_A" aleng "" "_O" (entlast) "") (princ) ) (prompt "\n\t\t*** Type CLD to execute *** \n") (princ) ;;; TesT : (C:CLD) Quote Link to comment Share on other sites More sharing options...
lpseifert Posted September 21, 2009 Share Posted September 21, 2009 If you have the pline drawn, try the Revcloud > Object option. If you really want the lisp edited, try replacing the (command "_.rectangle... with (command "_.pline") (while (= 1 (getvar "cmdactive")) (command pause)) you might want to get rid of the getpoint/getcorner Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 21, 2009 Share Posted September 21, 2009 I don't see why it is necessary. The RevCloud command has an option called Object. Create the outline of what you want the RevCloud to encompass with a polyline. Use the Object option of RevCloud and select the polyline. It is instantly turned into a RevCloud. Done. Why re-invent the wheel? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 21, 2009 Share Posted September 21, 2009 More fun in the Clouds: http://www.theswamp.org/index.php?topic=27297.0 Quote Link to comment Share on other sites More sharing options...
ronjonp Posted September 22, 2009 Share Posted September 22, 2009 Here is another that I use http://www.theswamp.org/index.php?topic=1319.0 Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted September 22, 2009 Author Share Posted September 22, 2009 I will try these links and also changing the LISP I already have. The reason I am looking for this is because currently I do draw a PLINE around what I need to cloud and use the object command in the cloud command to change the PLINE to a cloud. I also have to place the cloud on a certain layer after it is created, which I could add to the LISP. But it Isn't that this process is hard to do a couple times in a drawing, it is that I have to do this process several times in each of the 100+ drawings in a single project. One of the companies we work with has a command that does this but it uses visual basic and does not work on the ACAD we use. But I think I can make this work. Quote Link to comment Share on other sites More sharing options...
ReMark Posted September 22, 2009 Share Posted September 22, 2009 Thank you for the explanation. I'm sure one of the methods proposed above will be sufficient for your needs. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 22, 2009 Share Posted September 22, 2009 As a more robust routine: (defun c:cld (/ *error* cldlay ol) (vl-load-com) (setq cldlay "CLOUD_LAYER") ;; <<-- Layer for Cloud (defun *error* (msg) (and ol (setvar "CLAYER" ol)) (if doc (vla-EndUndoMark doc)) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-StartUndoMark doc) (or (tblsearch "LAYER" cldlay) (vla-add (vla-get-layers doc) cldlay)) (setq ol (getvar "CLAYER")) (command "_.pline") (while (= 1 (logand 1 (getvar "CMDACTIVE"))) (command pause)) (setvar "CLAYER" cldlay) (command "_.revcloud" "_O" (entlast) pause) (setvar "CLAYER" ol) (vla-EndUndoMark doc) (princ)) Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted September 22, 2009 Author Share Posted September 22, 2009 Great... Both adding that line to the lisp I had and this new LISP Lee has provided work great. I would like to add a little something to Lee's LISP though, how would I add settings to the layer that is being created Lee? The layer we place our clouds on needs to be blue or green, depending on its purpose. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 22, 2009 Share Posted September 22, 2009 You mean a prompt to ask the user what layer to use? Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted September 22, 2009 Author Share Posted September 22, 2009 No... I like how you have it written. There should be a layer in the drawing called C-Cloud and the color of that layer should be blue. If it is not there than your LISP will create it but I can't figure out how to make the color blue. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 22, 2009 Share Posted September 22, 2009 Like this: (defun c:cld (/ *error* cldlay cCol ol) (vl-load-com) (setq cldlay "C-CLOUD" cCol 5) ;; <<-- Layer/Col for Cloud (defun *error* (msg) (and ol (setvar "CLAYER" ol)) (if doc (vla-EndUndoMark doc)) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-StartUndoMark doc) (or (tblsearch "LAYER" cldlay) (vla-put-color (vla-add (vla-get-layers doc) cldlay) 5)) (setq ol (getvar "CLAYER")) (command "_.pline") (while (= 1 (logand 1 (getvar "CMDACTIVE"))) (command pause)) (setvar "CLAYER" cldlay) (command "_.revcloud" "_O" (entlast) pause) (setvar "CLAYER" ol) (vla-EndUndoMark doc) (princ)) Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted September 22, 2009 Author Share Posted September 22, 2009 I think you have the right idea with the forced color, however it is not working for my. The C-CLOUD layer still defaults to white. Unless I am supposed to change the number to the blue? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 22, 2009 Share Posted September 22, 2009 I think you have the right idea with the forced color, however it is not working for my. The C-CLOUD layer still defaults to white. Unless I am supposed to change the number to the blue? I have just changed the code such that if the layer does not exist, the created layer will be blue - I assumed that the layer you had was blue. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 22, 2009 Share Posted September 22, 2009 This should work either way (defun c:cld (/ *error* cldlay cCol ol) (vl-load-com) (setq cldlay "C-CLOUD" cCol 5) ;; <<-- Layer/Col for Cloud (defun *error* (msg) (and ol (setvar "CLAYER" ol)) (if doc (vla-EndUndoMark doc)) (if (not (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")) (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-StartUndoMark doc) (or (tblsearch "LAYER" cldlay) (vla-add (vla-get-layers doc) cldlay)) (vla-put-color (vla-item (vla-get-layers doc) cldlay) cCol) (setq ol (getvar "CLAYER")) (command "_.pline") (while (= 1 (logand 1 (getvar "CMDACTIVE"))) (command pause)) (setvar "CLAYER" cldlay) (command "_.revcloud" "_O" (entlast) pause) (setvar "CLAYER" ol) (vla-EndUndoMark doc) (princ)) Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted September 22, 2009 Author Share Posted September 22, 2009 That did it... Perfect... Thank you Lee. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 22, 2009 Share Posted September 22, 2009 That did it... Perfect... Thank you Lee. Not a problem Quote Link to comment Share on other sites More sharing options...
alanjt Posted September 22, 2009 Share Posted September 22, 2009 Lee, for your error handler, if you will check to see the msg variable has been filled, you can just call (*error* nil) and the end of a routine to run all closing procedures. Just an easy way to eliminate extra coding. Here's mine (I finally decided to adapt the wcmatch way. I remember the post @ theswamp, but I can't remember who did it.) (defun *error* (#Message) (and #Message (not (wcmatch (strcase #Message) "*BREAK*,*CANCEL*,*QUIT*")) (princ (strcat "\nError: " #Message)) ) ;_ and ) ;_ defun Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 22, 2009 Share Posted September 22, 2009 Lee, for your error handler, if you will check to see the msg variable has been filled, you can just call (*error* nil) and the end of a routine to run all closing procedures. Just an easy way to eliminate extra coding. Here's mine (I finally decided to adapt the wcmatch way. I remember the post @ theswamp, but I can't remember who did it.) (defun *error* (#Message) (and #Message (not (wcmatch (strcase #Message) "*BREAK*,*CANCEL*,*QUIT*")) (princ (strcat "\nError: " #Message)) ) ;_ and ) ;_ defun Yeah, I've seen that before, CAB used to use it a lot: (*error* nil) But imo, I don't like calling an error function unless there's an error.. maybe its just me PS> wcmatch accredited to Joe Burke Quote Link to comment Share on other sites More sharing options...
AQucsaiJr Posted September 22, 2009 Author Share Posted September 22, 2009 I have been reading a learning a little more each week on building LISP, but I can't figure this out, why should you have the error function in there? In reference to this cloud LISP, what would cause an error? 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.