ScoRm Posted September 27, 2018 Posted September 27, 2018 I'm sorry for asking too much with you guys, but i have this sample DWG file, and i want to match all the hatch based on the color of the Upper text... the idea I had was to match the color of the text on the hatch that is nearest to it... so thats the hatch behind the text... new block.dwg Quote
dlanorh Posted September 27, 2018 Posted September 27, 2018 Can you re-post drawing in Autocad 2010 format please Quote
ScoRm Posted September 27, 2018 Author Posted September 27, 2018 7 minutes ago, dlanorh said: Can you re-post drawing in Autocad 2010 format please here you go sir! and thank you in advance new block.dwg new block.dxf Quote
BIGAL Posted September 28, 2018 Posted September 28, 2018 try this (defun c:test ( / ss obj pt pt2 lst) (setq ss (ssget "x" (list (cons 0 "*text")(cons 8 "8017_textUp")))) (setvar "osmode" 16896) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq pt (vlax-safearray->list (vlax-variant-value(vla-get-insertionpoint obj)))) (setq col (vla-get-color obj)) (setq pt2 (polar pt 0.78 1)) (setq lst (list (list (car pt)(cadr pt))(list (car pt2)(cadr pt2)))) (command "chprop" (ssget "f" lst (list (cons 0 "hatch"))) "" "c" col "") ) ) Quote
ScoRm Posted September 28, 2018 Author Posted September 28, 2018 2 hours ago, BIGAL said: try this (defun c:test ( / ss obj pt pt2 lst) (setq ss (ssget "x" (list (cons 0 "*text")(cons 8 "8017_textUp")))) (setvar "osmode" 16896) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq pt (vlax-safearray->list (vlax-variant-value(vla-get-insertionpoint obj)))) (setq col (vla-get-color obj)) (setq pt2 (polar pt 0.78 1)) (setq lst (list (list (car pt)(cadr pt))(list (car pt2)(cadr pt2)))) (command "chprop" (ssget "f" lst (list (cons 0 "hatch"))) "" "c" col "") ) ) YES SIR!!! this is the one! OMG this routine is so useful!!!! thank you so much! Quote
BIGAL Posted September 29, 2018 Posted September 29, 2018 No worries a fairly straight forward task it can be improved like by pick text so you get the text layer rather than hard code, you can have a go at that. Be careful the pt2 is a bit of a fuzzy value so it find the hatch so in different size objects may not work 100%. Quote
ScoRm Posted September 29, 2018 Author Posted September 29, 2018 1 hour ago, BIGAL said: No worries a fairly straight forward task it can be improved like by pick text so you get the text layer rather than hard code, you can have a go at that. Be careful the pt2 is a bit of a fuzzy value so it find the hatch so in different size objects may not work 100%. Yeah i noticed, But im still using it. i just double the wrong ones and change it... this routine still helps me a lot, thanks! 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.