Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 11 of 33 (349 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 12:06 AM in reply to: raghavendrabhat6624

oops.. my bad

 

(defun c:HC ( / aDoc color)

....

 

Active Contributor
raghavendrabhat6624
Posts: 28
Registered: ‎11-17-2010
Message 12 of 33 (345 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 12:40 AM in reply to: raghavendrabhat6624

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!

*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 13 of 33 (342 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 12:49 AM in reply to: raghavendrabhat6624

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

 

 

 

Active Contributor
Posts: 37
Registered: ‎02-14-2008
Message 14 of 33 (333 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 01:09 AM in reply to: pbejse

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

DH
*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 15 of 33 (325 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 01:55 AM in reply to: heinz.dober

heinz.dober wrote:

Can we change that I can select a block in which I want to change the hatching
Thank you

 


Have you decided what to do with XREF objects?

Active Contributor
Posts: 37
Registered: ‎02-14-2008
Message 16 of 33 (322 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 02:01 AM in reply to: pbejse

X-ref I do not want to choose just one block.

X-ref brauche ich nicht, will nur einen Block wählen können

DH
Active Contributor
raghavendrabhat6624
Posts: 28
Registered: ‎11-17-2010
Message 17 of 33 (316 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 02:25 AM in reply to: pbejse

Thanks its Working!

*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 18 of 33 (311 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 02:38 AM in reply to: heinz.dober

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

  

Active Contributor
Posts: 37
Registered: ‎02-14-2008
Message 19 of 33 (302 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 02:48 AM in reply to: pbejse

Thank you 1000 times super:smileyhappy:

 

1000 mal Danke   super 

DH
*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 20 of 33 (297 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 02:58 AM in reply to: heinz.dober

heinz.dober wrote:

Thank you 1000 times super:smileyhappy:

 

1000 mal Danke   super 



raghavendrabhat6624 wrote:

Thanks its Working!

 


 

I didnt realize there were two of you :smileyvery-happy:

To both:
You are Welcome. Glad i could help
Cheers

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community