JeepMaster Posted January 11, 2008 Share Posted January 11, 2008 We use this light switch block for work. For the life of me, I can't figure out how to make the attribute to stay (LOCKED) at rotation 0 when inserting no matter which angle the swtich is inserted. The only way the text stays at rotation 0 is if I insert the block as is (pointing right), then align the switch to a wall. The block is created with alignment grip. So if I add the switch to a wall at an angle (eg:45 degrees), the text will be rotated and stay rotated. If I insert the switch on the left side of the wall, the attributes will be upside down. I can manually rotate the attributes back to 0 degrees and it will stay locked to 0 degrees. But what I want it to do is to be inserted at 0 degrees to begin with. Can this be done? Switch.dwg Quote Link to comment Share on other sites More sharing options...
skwirut Posted January 14, 2008 Share Posted January 14, 2008 Did you ever find a solution to your problem? I find myself in the same situation. Thanks. Quote Link to comment Share on other sites More sharing options...
Ozymandias Posted January 14, 2008 Share Posted January 14, 2008 the only way I was able to sort this out was to setup different view states i.e. 90,180,270 and 380 and with each state the attribute was set to 0. In effect the block rotates but the att stays local. alternatively you could set the main part of your block to a rotation grip.. let me know if you manage to come up with a better solution. Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted January 14, 2008 Author Share Posted January 14, 2008 the only way I was able to sort this out was to setup different view states i.e. 90,180,270 and 380 and with each state the attribute was set to 0. In effect the block rotates but the att stays local. alternatively you could set the main part of your block to a rotation grip..let me know if you manage to come up with a better solution. Ozy, my block has a rotation grip already. Do you mean adding another one for the attributes? So far, this block is the best I can do with minimal inputs. Drop the block to a floor plan while aligning to a wall, then change the attribute angle to zero manually. By now the attribute angle will stay locked to zero. Then copy as much switches as I need from it without rotation, then use the rotation grip on each block to rotate to match walls. Will lisp work on this? Somehow set rotation to zero and then insert block?!? Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted January 21, 2008 Author Share Posted January 21, 2008 Still no luck. Can it be done using lisp? Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted February 20, 2008 Author Share Posted February 20, 2008 the only way I was able to sort this out was to setup different view states i.e. 90,180,270 and 380 and with each state the attribute was set to 0. In effect the block rotates but the att stays local. alternatively you could set the main part of your block to a rotation grip..let me know if you manage to come up with a better solution. My friend help me out and wrote a reactor lisp. Once the reactor lisp is activated, everytime I use a symbol from the toolpalette, it will set all the attributes to 0 degrees. Commands are "ROT0" and "SROT0". Here's the code: (defun Attributs_ini(Rea Cde) (setq dernier_ent (entlast)) ) (defun Attributs_rot_0(Rea Cde / bl js i n) (cond ((eq (car Cde) "EXECUTETOOL") (setq js (ssget "_L")) ) ((eq (car Cde) "ROTATE") (setq js (ssget "_p")) ) ((eq (car Cde) "MIRROR") (setq js (ssget "_p")) ) ((eq (car Cde) "GRIP_ROTATE") (setq js (cadr (ssgetfirst))) ) ((eq (car Cde) "GRIP_MIROR") (setq js (cadr (ssgetfirst))) ) ; ((eq (car Cde) "INSERT") ; (setq js (ssadd)) ; (ssadd (entlast) js) ; ) ; ((eq (car Cde) "COPY") ; (setq js (ssadd) n (entnext dernier_ent)) ; (while n ; (ssadd n js) ; (setq n (entnext n)) ; ) ; ) ; ((eq (car Cde) "UCS") ; (setq js (ssget "x" (list (cons 0 "INSERT")))) ; ) ) (if js (progn (setq n 0) (while (ssname js n) (setq bl (entget (ssname js n))) (if (eq (cdr (assoc 0 bl)) "INSERT") (if (cdr (assoc 66 bl)) (progn (while (not (eq (cdr (assoc 0 bl)) "SEQEND")) (if (eq (cdr (assoc 0 bl)) "ATTRIB") (progn (setq bl (subst (cons 50 0) (assoc 50 bl) bl)) (entmod bl) (entupd (cdr (assoc -1 bl))) ) ) (setq bl (entget (entnext (cdr (assoc -1 bl))))) ) ) ) ) (setq n (1+ n)) ) ) ) (princ) ) (defun c:srot0(/ i j n) (if (setq i (vlr-reactors :vlr-Command-Reactor)) (progn (setq n 1 i (nth n (car i))) (while i (setq j nil) (if (or (eq (cdr (car (vlr-reactions i))) 'ATTRIBUTS_ROT_0) (eq (cdr (car (vlr-reactions i))) 'ATTRIBUTS_INI)) (setq j i) ) (if j (vlr-remove j) (setq n (1+ n)) ) (if (setq i (vlr-reactors :vlr-Command-Reactor)) (setq i (nth n (car i))) ) ) (if mrea_rot0 (princ "\n\tDisable angle 0 of the Attributes") ) (setq mrea_rot nil) ) ) (princ) ) (defun c:rot0() (if (not mrea_rot0) (progn (c:srot0) (vlr-command-reactor nil '((:vlr-commandwillstart . Attributs_ini))) (setq mrea_rot0 (vlr-command-reactor nil '((:vlr-commandEnded . Attributs_rot_0)))) (princ "\n\tEnable angle 0 of the Attributes") ) (princ "\n\tAngle 0 of the Attributes is ready") ) (princ) ) (vl-load-com) (princ (strcat "\n\tFor enable angle 0 of the Attributes, command ROT0.\n\tfor backward, command SROT0.")) (princ) Quote Link to comment Share on other sites More sharing options...
neekcotrack Posted July 31, 2008 Share Posted July 31, 2008 You can also use diesel macro to do this also. If you like you can put it into a lisp to do the same. Quote Link to comment Share on other sites More sharing options...
acampbell@cdfl.com Posted August 6, 2008 Share Posted August 6, 2008 I am also having the same problem and my boss wants me to write a lsp program to do the same as the RO (ROTATE) command but in addition rotate the attributes to 0 degrees. If any one has any answers let me know. I am using predefined blocks with attributes and not using the tool palette Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted August 8, 2008 Author Share Posted August 8, 2008 You can also you diesel macro to do this also. If you like you can put it into a lisp to do the same. I'm not familiar with diesel macro. Can you explain further? Quote Link to comment Share on other sites More sharing options...
neekcotrack Posted August 8, 2008 Share Posted August 8, 2008 Ok diesel macros are more used for tool palettes but are also used in lisp command to. If you attach a block that you are using I can look at it and make you a lisp that will ask you to pick what to rotate, then let you rotate it and last change your attrabute text back to 0. Quote Link to comment Share on other sites More sharing options...
dbroada Posted August 9, 2008 Share Posted August 9, 2008 does my answer in this thread http://www.cadtutor.net/forum/showthread.php?t=13651&page=2 help? Quote Link to comment Share on other sites More sharing options...
neekcotrack Posted August 11, 2008 Share Posted August 11, 2008 If you use the flyout Tool Pallete Buttons you will find it is easier to get the attributes to stay at 0 no matter what angle it is. You will see in the command string area this something that looks weird. That would be diesel macro it is one of autocads easier code to use. If still interested let me know. Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted August 11, 2008 Author Share Posted August 11, 2008 Thanks dbroada, but I don't have a problem making the block to do the "fairest wheel" thing on the attribute. I only need to be able to insert the block at any angle from the toolpalette while the attribute stays locked to zero rotation. neekcotrack, will you please be so kind to show me how to use it on diesel macro to do this. My example switch block is still on the first post. Quote Link to comment Share on other sites More sharing options...
neekcotrack Posted August 11, 2008 Share Posted August 11, 2008 Ok try the block that I attach and make your code like I have below In the command string of the tool pallete button properties. Just make sure add another search path under option to be going to where you put the block! -I;sw_1;s;(getvar "dimscale");\\-attedit;;;;;l;;a;0;; Tell me if this is what you are looking for? Quote Link to comment Share on other sites More sharing options...
neekcotrack Posted August 11, 2008 Share Posted August 11, 2008 I made a .xtp file of a Tool Palette with the Button already setup in it. I hope you can import .xtp files. Quote Link to comment Share on other sites More sharing options...
asos2000 Posted August 18, 2008 Share Posted August 18, 2008 how to load *.xtp file Thanx Quote Link to comment Share on other sites More sharing options...
JeepMaster Posted August 19, 2008 Author Share Posted August 19, 2008 Ok try the block that I attach and make your code like I have below In the command string of the tool pallete button properties. Just make sure add another search path under option to be going to where you put the block! -I;sw_1;s;(getvar "dimscale");\\-attedit;;;;;l;;a;0;; Tell me if this is what you are looking for? It seems like the block is different. I need to use our company standard dynamic blocks like the one I posted. Quote Link to comment Share on other sites More sharing options...
jcparms Posted January 15, 2013 Share Posted January 15, 2013 (edited) After a few days of trying to do this myself, looking online for answers, and not wanting to use a lisp; I've figured out an answer. Although I have not tested it extensively, it seems to work. 1. Assemble your block, and place the Parameters like you would normally. 2. Place a Point Parameter at the middle of your text (I have my text justified at middle). 3. Associate a Move Action to that point, and only include the text. 4. Add the other Actions you want. When making your Rotation Action, do so so it does not include the text from the Action, but does include the Move Parameter and Grip associated to the text. 5. Select the Move Action associated with your text. In the Properties, change the Number of Grips to 0, and set Chain Actions to "yes". This SHOULD work. Like I said, I haven't tested real complex blocks yet. Hope it helps some people out! Edited January 15, 2013 by jcparms Excess words... Misspelling... Quote Link to comment Share on other sites More sharing options...
dbroada Posted January 15, 2013 Share Posted January 15, 2013 This SHOULD work. Like I said, I haven't tested real complex blocks yet. Hope it helps some people out!it does work - that method was put forwards by me in post 11 of this thread Quote Link to comment Share on other sites More sharing options...
jcparms Posted January 16, 2013 Share Posted January 16, 2013 Yeah I'm pretty new to the whole forum thing, and never noticed there were more than one page until I posted... Whoops! 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.