ziofel Posted October 14, 2010 Posted October 14, 2010 Hello, is there any way that you can set the layer attributes to something other than the item that you are offsetting? For example I have a line on a BLDG layer in Color red but I want to offset that line to be in the GYPSUM layer with a color #8 (Grey) attribute. This would really be helpful for I use Autocad for designing homes. Thank you Raff P.S. I looked but never found any threads similar Quote
rkmcswain Posted October 14, 2010 Posted October 14, 2010 Set your destination layer current. Run the Offset command, press L, press C, continue the offset command. Quote
ziofel Posted October 14, 2010 Author Posted October 14, 2010 You are awesome. Thank you very much, from the whole office LOL. Quote
rkent Posted October 14, 2010 Posted October 14, 2010 There are some lisp routines out there but it really is easier to set the layer current and offset. Actually you could write a pretty simple lisp to define OG as offset to gypboard layer, etc., where it would change the layer prior to launching the offset command. Or a simple macro for a toolpalette, etc. Quote
ziofel Posted October 14, 2010 Author Posted October 14, 2010 Oh is therre a way to set a button to this or does it have to be done this way every time? It will work if I change to a different layer but what if I wanted same layer but different color? I have a BLDG layer with color white and trying to offset it to a color blue and not working. Quote
rkent Posted October 14, 2010 Posted October 14, 2010 Yeah, I think a lisp routine would be required. I am not much on lisp but I know it can be done. At the start of the routine the layer would be created or set, the distance could be built in, like 1/2" or 5/8" for the gypboard example, offset would be called, you would point to the side, then the last entity would be changed to the current layer. Maybe ask over in the customization forum. Quote
ziofel Posted October 14, 2010 Author Posted October 14, 2010 Good call, over to customization I go. Quote
rkent Posted October 14, 2010 Posted October 14, 2010 This is one I cobbled together, you would have to keep customizing it for the layers, colors and distances you would want preset. There are much more elegant solutions but this works. (DeFun C:OFFM ( / clayer ENTITY) ; change OFFM to any name you like that doesn't already exist (SetVar "CmdEcho" 0) (INITGET "G g S s B b U u") ; add a unique letter for each material you add (SETQ MatType (strcase (getkword "\nGypboard Stud Brick stUcco..? "))) (COND ((= MatType "B") ;set this letter to match one of the choices three lines above, B = brick (SETQ layernam "BRICK") ;change BRICK to a layer name you would use, repeat for those below (SETQ offsetdista "2.5") ;change to offset distance for brick, repeat for those below (SETQ layercolor "1") ;set color to what you would want, repeat for those below ) ((= MatType "G") (SETQ layernam "GYPSUM") (SETQ offsetdista "5/8") (SETQ layercolor "4") ) ((= MatType "S") (SETQ layernam "STUD") (SETQ offsetdista "3.5") (SETQ layercolor "2") ) ((= MatType "U") (SETQ layernam "STUCCO") (SETQ offsetdista "1") (SETQ layercolor "3") ) );close cond (COMMAND ".LAYER" "make" LAYERNAM "color" layercolor "" "") (Command ".OFFSET" offsetdista pause pause "") (SetQ ENTITY (EntLast) ENTITY (EntGet ENTITY) ENTITY (SubSt (Cons 8 layernam) (Assoc 8 ENTITY) ENTITY) ) (EntMod ENTITY) (SetVar "CmdEcho" ECHO) (PrinC) ) Quote
irneb Posted October 16, 2010 Posted October 16, 2010 Here's one which uses the current settings for Layer, Colour, Linetype, Lineweight and Object Linetype Scale. Command is OffsetCurrent (vl-load-com) ;;; Parse a string to a list of strings splitting at delimeter ;;; From: http://thatcadguy.blogspot.com/2009/10/parsing-csv-files-with-autolisp.html (defun str2lst (strg delim trim / templist pos) (if trim (setq strg (vl-string-trim delim strg)) ) (setq templist (list)) (while (setq pos (vl-string-search delim strg)) (setq templist (cons (substr strg 1 pos) templist) strg (substr strg (+ 2 pos)) ) ) (reverse (cons strg templist)) ) ;;; Command to offset to current layer / color / linetype / lineweight / linetypescale (defun c:OffsetCurrent (/ elast Run) ;; Helper function to modify the last object (defun Run (en / eo color) (setq eo (vlax-ename->vla-object en)) (vla-put-Layer eo (getvar "CLAYER")) (setq color (strcase (getvar "CECOLOR"))) (cond ((wcmatch color "RGB:*") (setq color (str2lst (substr color 5) "," t)) (setq eco (vla-get-TrueColor eo)) (vla-SetRGB eco (atoi (car color)) (atoi (cadr color)) (atoi (caddr color))) (vla-put-TrueColor eo eco) ) ((wcmatch color "BYLAYER") (vla-put-Color eo 256)) ((wcmatch color "BYBLOCK") (vla-put-Color eo 0)) (t (vla-put-Color eo (atoi color))) ) (vla-put-LineType eo (getvar "CELTYPE")) (vla-put-Lineweight eo (getvar "CELWEIGHT")) (vla-put-LinetypeScale eo (getvar "CELTSCALE")) ) ;; Run the offset command until the user completes (setq elast (entlast)) (command "._OFFSET") (while (= (logand (getvar "CMDACTIVE") 1) 1) (if (not (eq elast (entlast))) (Run (setq elast (entlast))) ) (command pause) ) (princ) ) 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.