Scotth066 Posted May 22, 2024 Posted May 22, 2024 (edited) Sorry if this is in the wrong forum. Feel free to move if it is. I am not real versed in lisp/macro writing. I know a little but not enough. I am trying to write a command macro that will save the current layer to "clyr", create a new layer "ANNO-REV-01", draw a rectangle, change that rectangle to a revcloud, insert a revision delta and finally reset the clayer to "clyr". I was having issues trying to do this all in the macro so I created a "createrevlayer" lisp routine. It works . . . sort of. Here is my current macro ^C^C$(setq clyr(getvar "clayer")) (IF (NOT c:createrevlayer)(LOAD"//rsavm-1/CommonShare/ACAD/CUSTOM FILES/LISP/createrevlayer.lsp")) createrevlayer;\_rectangle;\\_revcloud;a;.25;.25;O;L;N;_insert;rev-delta;\;0;\;^C$(setvar "clayer" clyr) I have a few question: 1) I created the "createrevlayer" lisp because I was having issues with doing it in the actual macro. Can someone help me with that so I can get rid of the lisp. If someone can help with that, then I can fix the issue of being able to put the rev-delta on it's own layer. Here is my lisp routine. (defun c:CreateRevLayer () (setq revNumber (getint "\nEnter the revision number: ")) ; Prompt the user for an integer (setq layerName (strcat "ANNO-REV-" (itoa revNumber))) ; Concatenate "ANNO-REV-" with the entered integer (command "_layer" "_make" layerName "c" "6" "" "") ; Create a new layer with the generated name (princ) ) Aslo, I would like for the layer name to have a "0" proceeding all the single digit numbers (1-9), ie. "ANNO-REV-01, ANNO-REV-02 . . . and so on. But not put the "0" in front of any double digit revisions, such as "ANNO-REV-10, ANNO-REV-11 . . . That would keep inline with our layer naming standard. I just don't know how to achieve that. 2) Next, the (setq clry(getvar "clayer")) is clearly the wrong syntax because that and the setvar are not working. Any help would be greatly appreciated. Thank you, Scott Edited May 22, 2024 by SLW210 Added Code Tags! Quote
BIGAL Posted May 23, 2024 Posted May 23, 2024 (edited) Ok did what you want pick object it auto makes a rectang, converts to revcloud. Pretty sure has a layer for revcloud. Let me know if suitable. https://www.cadtutor.net/forum/topic/84863-revcloud-around-polyline-object-on-both-sides-but-retain-polyline/ Edited May 23, 2024 by BIGAL Quote
mhupp Posted May 23, 2024 Posted May 23, 2024 Updated code combine with BIGAL's link and you should be good to go. ;;----------------------------------------------------------------------------;; ;; Create Rev Layer and make a rev cloud ;; https://www.cadtutor.net/forum/topic/85860-help-with-command-macros/ (defun C:RevLayer () (C:RL)) (defun c:RL (/ olay layname) (setq olay (getvar 'clayer)) ;save old layer name (setq layname (strcat "ANNO-REV-" (itoa (getint "\nEnter the revision number: ")))) ;Create new layer name (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") (cons 2 layname) '(70 . 0) '(62 . 6) '(290 . 0))) (setvar 'clayer layname) ;set new layer to current ; add code for rev cloud (setvar 'clayer olay) ;set to old layer before command was run. ) Quote
pkenewell Posted May 23, 2024 Posted May 23, 2024 @Scotth066 This seems very similar to this recent thread. Perhap you can learn something from it? Quote
Scotth066 Posted July 9, 2024 Author Posted July 9, 2024 I completely forgot to respond. Got it working. Thanks for all the help. Quote
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.