Author Topic: trim solid hatch  (Read 671 times)

0 Members and 1 Guest are viewing this topic.

domenicomaria

  • Bull Frog
  • Posts: 272
trim solid hatch
« 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 ?

« Last Edit: June 29, 2021, 10:39:04 AM by domenicomaria »

danAllen

  • Newt
  • Posts: 22
Re: trim solid hatch
« Reply #1 on: June 29, 2021, 11:12:22 AM »
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?


Code: [Select]
(-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)

domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #2 on: June 29, 2021, 11:48:05 AM »
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
...

danAllen

  • Newt
  • Posts: 22
Re: trim solid hatch
« Reply #3 on: June 29, 2021, 02:27:18 PM »
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.

Code: [Select]
: (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 >>

domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #4 on: June 29, 2021, 02:35:29 PM »
hatch SOLID ?

danAllen

  • Newt
  • Posts: 22
Re: trim solid hatch
« Reply #5 on: June 29, 2021, 05:43:15 PM »
trimming a hatch with solid pattern? yes

script showing trim command accepts a point on the hatch boundary to trim it

Code: [Select]
(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

BIGAL

  • Swamp Rat
  • Posts: 831
  • 30 + years of using Autocad
Re: trim solid hatch
« Reply #6 on: June 29, 2021, 08:24:53 PM »
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.
A man who never made a mistake never made anything

domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #7 on: June 30, 2021, 01:58:12 AM »
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

domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #8 on: June 30, 2021, 04:29:44 AM »
https://drive.google.com/file/d/1RWzO6168TsDCuEcIeZdPzTqJYZrjZvQT/view?usp=sharing

this is what I want to achieve

I did it with a workaround


domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #9 on: June 30, 2021, 04:46:15 AM »
CookieCutter2 v1.1.lsp
doesn't do what i did
(with a workaround)

domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #10 on: June 30, 2021, 06:02:37 AM »

ribarm

  • Gator
  • Posts: 2527
  • Marko Ribar, architect
Re: trim solid hatch
« Reply #11 on: June 30, 2021, 06:18:01 AM »
Isn't it that you achieved what you wanted?
How did you make those *.mp4 files - aren't they from your Google Drive?
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #12 on: June 30, 2021, 08:31:34 AM »
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"

« Last Edit: June 30, 2021, 08:34:51 AM by domenicomaria »

ribarm

  • Gator
  • Posts: 2527
  • Marko Ribar, architect
Re: trim solid hatch
« Reply #13 on: June 30, 2021, 08:51:15 AM »
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...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

domenicomaria

  • Bull Frog
  • Posts: 272
Re: trim solid hatch
« Reply #14 on: July 01, 2021, 07:45:21 AM »
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 . . .