CHANGE THE BACKGROUND COLOR OF A HATCHING VIA AUTOLISP

CHANGE THE BACKGROUND COLOR OF A HATCHING VIA AUTOLISP

pemattosarq
Explorer Explorer
318 Views
3 Replies
Message 1 of 4

CHANGE THE BACKGROUND COLOR OF A HATCHING VIA AUTOLISP

pemattosarq
Explorer
Explorer

I'd like to create a Visa Lisp function that displays a configuration menu and allows the user to enter various hatch settings through a window. I'm managing to do this, but I'm having trouble with one thing. I'd like the user to select the background color and line color for the hatch, but I'm having trouble doing that. What is the simplest way I could do this?

 

- The user selects a color image from the menu, and this affects the background color or the hatch line color.Screenshot_1.png

0 Likes
Accepted solutions (1)
319 Views
3 Replies
Replies (3)
Message 2 of 4

BlackBox_
Advisor
Advisor

You'll need to append/modify a Hatch's "HATCHBACKGROUNDCOLOR" XData, and handle converting the color selection from dotted pair that represents the ACI or True Color selected (say you're using acad_truecolordlg function), to the 32-bit "long" that gets packed into the regapp's 1071 value. 


"How we think determines what we do, and what we do determines what we get."

Sincpac C3D ~ Autodesk Exchange Apps

0 Likes
Message 3 of 4

paullimapa
Mentor
Mentor
Accepted solution

what if after you apply the Hatch you use AutoCAD's built-in Hatchedit command to change the color of the hatch & the background color:

(command "-HATCHEDIT" (entlast) "_CO" "." ".") ; this sets hatch color & background color to none 
(command "-HATCHEDIT" (entlast) "_CO" "1" "252") ; this sets hatch color to 1 which is Red & background color to 252

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 4 of 4

komondormrex
Mentor
Mentor

@pemattosarq 

you'd better not use protected symbol names for variables.

 

komondormrex_0-1755800819631.png