Hi, in the first routine that you mentioned is it possible to change the hatch colour within the Block references or any DWG references?
Any assistance will be of great help.
Thanks
@raghavendrabhat6624 wrote:Hi, in the first routine that you mentioned is it possible to change the hatch colour within the Block references or any DWG references?
Any assistance will be of great help.
Thanks
Hatch of a specific pattern? to what color? Block modifcation affects all intances on a single drawing.
DWG references?
Are you refering to XREF?
All Hatch patterns
Yes needed to reflect in all block references!
yes Xref's
(defun c:HC ( aDoc color) (vl-load-com) (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (if (setq color (acad_colordlg 7 t)) (progn (vlax-for blk (vla-get-blocks aDoc) (if (and (eq :vlax-false (vla-get-islayout blk)) (eq :vlax-false (vla-get-isxref blk)) ) (vlax-for itm blk (if (eq (vla-get-ObjectName itm) "AcDbHatch" ) (vla-put-color itm color) ) ) ) ) (vla-regen adoc acActiveViewport) ) ) (princ) )
I get this error,
error: too few arguments
Do i need to load some variables, please let me know
I figured out "/" was missing in the defun line.
The lisp changes the colour of hatches in the blocks, but not the reference files, I mean the Xref , Any idea!
@raghavendrabhat6624 wrote:I figured out "/" was missing in the defun line.
The lisp changes the colour of hatches in the blocks, but not the reference files, I mean the Xref , Any idea!
Listen, we can include xref objects by taking this line out
(eq :vlax-false (vla-get-isxref blk))
But i would advice against it.. XREF are so named and to be trated as such. a Reference drawing.
Any modifications should be done on the drawing
Just my 2 cents
(if (eq :vlax-false (vla-get-islayout blk)) (vlax-for itm blk (if (eq (vla-get-ObjectName itm) "AcDbHatch" ) (vla-put-color itm color) ) ) )
Can we change that I can select a block in which I want to change the hatching
Thank you
Kann man das ändern das ich einen Block wählen kann bei dem ich die Schraffur ändern will
Danke
@heinz.dober wrote:X-ref I do not want to choose just one block.
X-ref brauche ich nicht, will nur einen Block wählen können
Quick mod
NO XREF on selection mode/ Option to process all BLOCKS/XREF
(defun c:HC (/ _Chatch blk obj aDoc color) (vl-load-com) (defun _Chatch (b c) (vlax-for itm b (if (eq (vla-get-ObjectName itm) "AcDbHatch" ) (vla-put-color itm c) ) ) ) (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (initget "A") (if (setq obj (entsel "\nSelect object to process/A for all: ")) (progn (cond ((listp obj) (if (and (eq "AcDbBlockReference" (vla-get-ObjectName (Setq blk (vlax-ename->vla-object (car obj))) ) ) (not (vlax-property-available-p blk 'Path)) (setq blk (vla-item (vla-get-blocks aDoc) (vla-get-EffectiveName blk ) ) ) (setq color (acad_colordlg 7 t)) ) (_Chatch blk color) (princ "\nObject Not a Block:") ) ) ((eq obj "A") (setq color (acad_colordlg 7 t)) (vlax-for blk (vla-get-blocks aDoc) (if (and (eq :vlax-false (vla-get-islayout blk)) (eq :vlax-false (vla-get-isxref blk)) ) (_Chatch blk color) ) ) ) ) (if color (vla-regen adoc acActiveViewport)) ) ) (princ) )
Command: hc
Select object to process/A for all:
HTH
@heinz.dober wrote:Thank you 1000 times super
1000 mal Danke super
@raghavendrabhat6624 wrote:Thanks its Working!
I didnt realize there were two of you
To both:
You are Welcome. Glad i could help
Cheers