HATCH SOLID

HATCH SOLID

sigmmadesigner
Advocate Advocate
816 Views
17 Replies
Message 1 of 18

HATCH SOLID

sigmmadesigner
Advocate
Advocate

WHY THIS CONFIGURATION DOES NOT ACCEPT SOLIDS
;; DRAW
(command "_.PLINE" ptBase1 topoPt ptBase2 "C")
(setq triEnt (entlast))
(command "_.HATCH" "ANSI31" ".001" "0" triEnt "")
(setq hacEnt (entlast))
(command "_.CHPROP" hacEnt "" "Color" "30" "")
)

0 Likes
817 Views
17 Replies
Replies (17)
Message 2 of 18

cadffm
Consultant
Consultant

Because you don't have a hatch pattern with name "Solids" ?

SOLID

And I guess, -hatch don't asking for an angle.

Set CMDECHO to 1

Run your (command...) with SOLID

and press [F2]

and you can see what the problem is.

Share a screenshot if you can not see the issue.

Sebastian

0 Likes
Message 3 of 18

ВeekeeCZ
Consultant
Consultant

...nor the scale

 

(command "_.HATCH" "solid" triEnt "")

0 Likes
Message 4 of 18

komondormrex
Mentor
Mentor

i think

(command-s "_.HATCH" "solid" ".001" "0" triEnt "")

will do

0 Likes
Message 5 of 18

paullimapa
Mentor
Mentor

FYI: Here's another way to change the hatch color:

(command "_.Hatchedit" (entlast) "_Co" "30")

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 18

cadffm
Consultant
Consultant

The original code works, so I guess sigmmadesigner ised the wrong pattern name

 
 

 

 

Sebastian

0 Likes
Message 7 of 18

sigmmadesigner
Advocate
Advocate

Hello everyone,  @cadffm @paullimapa @komondormrex @ВeekeeCZ
I tried, all the possibilities posted last I even joked.. it's just add solido that the function gives an error.

Thank you all for contributing!!!

 

 

0 Likes
Message 8 of 18

paullimapa
Mentor
Mentor

did you try changing the code to what both @cadffm & @ВeekeeCZ mentioned:

(command "_.HATCH" "solid" triEnt "")

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

paullimapa
Mentor
Mentor

also try it with an underscore in front of solid:

(command "_.HATCH" "_solid" triEnt "")

 


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

cadffm
Consultant
Consultant

Your original hatch-codeline should works with solid.

I miss your Textscreen [F2] screenshot, while cmdecho is 1

Sebastian

0 Likes
Message 11 of 18

sigmmadesigner
Advocate
Advocate
 
 
THIS WAS THE SOLUTION
command "_.PLINE" (car rect1) (cadr rect1) (caddr rect1) (cadddr rect1) "C")
(setq rectEnt1 (if (/= (entlast) entBefore) (entlast) nil))
 
(if rectEnt1 (progn (command "_.CHPROP" rectEnt1 "" "Color" "40" "")
(command "_.HATCH" "SOLID" rectEnt1 "")
(setq hatch1 (entlast))
(command "_.CHPROP" hatch1 "" "Color" "40" ""))
    (princ "\n ERROR HATCH SOLID"))
0 Likes
Message 12 of 18

paullimapa
Mentor
Mentor

so isn't your revised line of code:

(command "_.HATCH" "SOLID" rectEnt1 "")

similar to what we posted:

(command "_.HATCH" "_solid" triEnt "")

triEnt was the variable you used in your OP:

(setq triEnt (entlast))

Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 13 of 18

komondormrex
Mentor
Mentor

watch the gif

0 Likes
Message 14 of 18

sigmmadesigner
Advocate
Advocate

lsp only accepted to apply solid hatching if with
(setq rectEnt1 (if (/= (entlast) entBefore) (entlast) nil))
with respect to rectEnt1, triEnt were the types of objects that would receive the function, rectangles and triangles.

0 Likes
Message 15 of 18

sigmmadesigner
Advocate
Advocate

what madness, in msg 7/14 changing the type to stop programming

0 Likes
Message 16 of 18

paullimapa
Mentor
Mentor

looks like we are not seeing the entire code because entBefore is not defined in the code you've posted.  


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 17 of 18

sigmmadesigner
Advocate
Advocate

Hi, @paullimapa 

There is actually no line above this fragment, which means a variable that receives the selection of what was previously created and stores it, so that it can later recognize the limits and place the solid hatch, as exemplified by @komondormrex the solid hatch depends on you determining the limit points, and the entBefore function does this storage so that the solid hatch is applied. That's why in my video when I use the function directly it gives an error, and with this proposition I store the object to apply the solid.
I don't know if I explained it well.

example:

;points of the rectangle

 

(setq rectPts (list   (polar (polar pt ra(/ fa -2)) (+ ra (/ pi 2)) (/ FE_width 2))
(polar (polar pt ra(/ fa 2))  (+ rectAngle (/ pi 2)) (/ fw2))
(polar (polar pt ra(/ fa 2))  (+ rectAngle (/ pi 2)) (/ fw-2))
(polar (polar pt ra(/ fa -2)) (+ rectAngle (/ pi 2)) (/ fw-2))))
 
;; Stores the last entity before the PLINE command
  (setq entBefore (entlast))
 
;; Draw the strip rectangle (closed polyline)
  (command "_.PLINE" (car rectPts) (cadr rectPts) (caddr rectPts) (cadddr rectPts) "C")
 
;; Stores the last created entity (strip rectangle)
  (setq entAfter (entlast))
  (setq rectEnt (if (/= entBefore entAfter) entAfter nil))
 
;; If rectangle was created, apply color and hatch properties
  (if rectEnt (progn  (command "_.CHPROP" rectEnt "" "Color" "253" "") 
  (command "_.HATCH" "SOLID" rectEnt "")           ;; Hatch solid
  (setq hacEnt (entlast))
  (command "_.CHPROP" hacEnt "" "Color" "253" "")  ));; Hatch color same contour


ent + Before

 

0 Likes
Message 18 of 18

paullimapa
Mentor
Mentor

So it sounds like your closed pline creation has a possibility of failing which is why you've added the test to see if the last entity is different than your previous last entity. But if there's no problems with the closed pline being generated then the same hatch command works.

 


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