TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: domenicomaria on June 29, 2021, 10:32:17 AM
-
I have a closed, not self-intersecting, lwpolyline.
And a solid hatch that intersects the lwpolyline.
I want trim (via VLisp) the solid hatch,
removing the external part (to the lwpolyline) of the hatch and keeping the internal part of the hatch.
To do this,
I need to know an external (to the lwpolyline) point
that is OVER the solid hatch.
To know if the point is internal or external to the lwpolyline,
it is easy.
But to find a point that is OVER the solid hatch ?
I have no idea about how this can be found !
Any idea ?
-
Does the hatch entity list with group 10 points not work?
Would it be easier to just create a new solid hatch with the poly and erase the old hatch?
(-1 . <Entity name: 7a736920>)
(0 . "HATCH")
(5 . "23B")
(102 . "{ACAD_XDICTIONARY")
(360 . <Entity name: 7a736360>)
(102 . "}")
(330 . <Entity name: 1ae7ebf0>)
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbHatch")
(10 0.0 0.0 0.0)
(210 0.0 0.0 1.0)
(2 . "SOLID")
(70 . 1)
(71 . 0)
(91 . 1)
(92 . 3)
(72 . 0)
(73 . 1)
(93 . 7)
(10 33.4576527373164 43.0348906633721 0.0)
(10 22.4892480054013 29.8655889293293 0.0)
(10 26.8188814522099 28.7471002889038 0.0)
(10 39.8077817926357 37.2259657889039 0.0)
(10 30.7516318330611 22.8660148569888 0.0)
(10 46.338312241572 32.1025662101804 0.0)
(10 51.3534709841252 39.4990233484784 0.0)
(97 . 0)
(75 . 0)
(76 . 1)
(98 . 0)
-
the dxf codes 10
are the points of the BOUNDARY ...
...
they are NOT OVER
the SOLID HATCH
...
TRIM, with SOLID HATCH,
needs a point OVER the hatch
...
-
I don't know the answer to your question. But if you are using command calls to trim the hatch using the pline, I did a test assigning a variable to the midpoint of two vertices that defined the boundary of the hatch, then passing the variable to command trim was successful in trimming the hatch.
: (setq t1 (getpoint))
_mid
Snap to _midpoint of: (42.6076986005204 13.5530535222578 0.0)
: t
Select cutting entities for trim <ENTER to select all>: << SELECTED PLINE >>
Entities in set: 1
Select cutting entities for trim <ENTER to select all>:
Fence/Crossing/Edge mode/Projection/eRase/<Select entity to trim or shift-select to extend>: !t1
(42.6076986005204 13.5530535222578 0.0)
<< resulted in trimmed hatch >>
-
hatch SOLID ?
-
trimming a hatch with solid pattern? yes
script showing trim command accepts a point on the hatch boundary to trim it
(setq t1 250)
delay 1000
pickstyle 0
blipmode 1
e all
cecolor 0
delay !t1
rectangle 0,0 4,4
cecolor 8
delay !t1
bhatch se si (entlast)
delay !t1
e all r l
cecolor 2
delay !t1
rectangle 1,1 3,3
delay !t1
trim si (entlast) 0,2
;;;redraw
-
I think the erase and use bpoly would be easier, as there is no dwg or images bit hard to comment. Pick hatch in area to keep, erase and recreate.
-
if i select a point on the boundary,
the no-entry symbol appears,
and trim doesn't work.
while,
if i select a point OVER the hatch
the no-entry symbol does not appear,
the part of the hatch that will be trimmed,
changes its color,
and the trim command, works well.
My question is :
via Vlisp,
what have I to do
to get an internal point,
in the part of the hatch
that i want trim ?
I had thought that I can generate the outline boundary of the "solid hatch",
divide it into segments, (when there are curves),
check the direction of the list of points,
calculate an internal parallel to the list of points
that represents the boundary,
and take a point from this new list of points. . .
. . .
but I hope there is a simpler way
-
https://drive.google.com/file/d/1RWzO6168TsDCuEcIeZdPzTqJYZrjZvQT/view?usp=sharing
this is what I want to achieve
I did it with a workaround
-
CookieCutter2 v1.1.lsp
doesn't do what i did
(with a workaround)
-
https://drive.google.com/file/d/1vZR_O4lMy8nMfFCSMomLoY9ENc7Cj44H/view?usp=sharing
this is what i wanted to acheive !
-
Isn't it that you achieved what you wanted?
How did you make those *.mp4 files - aren't they from your Google Drive?
-
Isn't it that you achieved what you wanted?
How did you make those *.mp4 files - aren't they from your Google Drive?
I did the mp4 file
and put it on my google drive
I use MOAVI SCREEN RECORDER . . .
the trick to trim solid hatches is this:
1 - I generate the boundary
2 - compute the bounding box of the boundary and its base and height
3 - I divide the smallest bounding box size by 3.0 and use it as the distance between the lines of a "user hatch"
4 - I replace the "solid" hatches with a "user" hatches
5 - I check the intersections between the "user" hatches
and the polyline obtained from the external offset of the selected polyline.
6 - And then I "trim" all the hatches, using the intersections found,
and finally reset the hatch type from "user" to "solid"
-
Interesting trick...
However, if I was to draw things and needed that drawing, I'd probably make block and just CLIPIT with boundary curve - although not so precise as curve has to be polyline and there is also some fuzz that you must use when CLIPIT. But I'd rather do it this way then doing trimming and loosing original geometry...
-
https://drive.google.com/file/d/1b7ySVnQhl1bFT17jVqR9fmHvJgmvTYxI/view?usp=sharing
it is not really so slow . . .
the screen recorder make it very slow . . .
but it works better . . .
-
https://drive.google.com/file/d/1d6Jo1TwBHYGuMODuZgvQNroVoAFeVGdt/view?usp=sharing
. . . the version. 1.1 . . . :-)
-
if i select a point on the boundary,
the no-entry symbol appears,
and trim doesn't work.
while,
if i select a point OVER the hatch
the no-entry symbol does not appear,
the part of the hatch that will be trimmed,
changes its color,
and the trim command, works well.
My question is :
via Vlisp,
what have I to do
to get an internal point,
in the part of the hatch
that i want trim ?
I had thought that I can generate the outline boundary of the "solid hatch",
divide it into segments, (when there are curves),
check the direction of the list of points,
calculate an internal parallel to the list of points
that represents the boundary,
and take a point from this new list of points. . .
. . .
but I hope there is a simpler way
Let you fully master handling HATCH:
https://www.theswamp.org/index.php?topic=58727.0
https://www.theswamp.org/index.php?topic=58726.0
https://www.theswamp.org/index.php?topic=58725.0