Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Expert Elite*
pbejse
Posts: 2,502
Registered: ‎11-24-2009
Message 11 of 33 (417 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 (413 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*
pbejse
Posts: 2,502
Registered: ‎11-24-2009
Message 13 of 33 (410 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
cadheinz
Posts: 37
Registered: ‎02-14-2008
Message 14 of 33 (401 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*
pbejse
Posts: 2,502
Registered: ‎11-24-2009
Message 15 of 33 (393 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 01:55 AM in reply to: cadheinz

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
cadheinz
Posts: 37
Registered: ‎02-14-2008
Message 16 of 33 (390 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 (384 Views)

Re: HATCH COLOUR LISP ROUTINE

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

Thanks its Working!

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

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 02:38 AM in reply to: cadheinz

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
cadheinz
Posts: 37
Registered: ‎02-14-2008
Message 19 of 33 (370 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*
pbejse
Posts: 2,502
Registered: ‎11-24-2009
Message 20 of 33 (365 Views)

Re: HATCH COLOUR LISP ROUTINE

11-21-2012 02:58 AM in reply to: cadheinz

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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!