Jump to content

Recommended Posts

Posted

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

Posted

Can you re-post drawing in Autocad 2010 format please

Posted

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 "")
)
)

Posted
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!

Posted

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%.

Posted
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!

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...