Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

About Hatch

19 REPLIES 19
SOLVED
Reply
Message 1 of 20
F.Camargo
643 Views, 19 Replies

About Hatch

Hi all,

I created a hatch and I'd to know if there is how to count how many square has inside of the perimeter.

 

Maybe a lisp can help me doing that.

 

Regards

19 REPLIES 19
Message 2 of 20
3wood
in reply to: F.Camargo

Instead of using hatch, you can create a polyline square then array it to fill an area larger then the boundary. Explode the array object.

Then use attached SMARTSEL.vlx with WP option to select all square inside. It will report how many squares selected.

You can select multiple polylines/circles as boundaries.

 

Command: smartsel

Selecting mode [Wp/Cp] <Cp>:wp

Find all circles/Polylines on same layer as selecting boundary? [Yes/No] <Y>:n
Pick a circle/polyline:
Pick a circle/polyline:
Checking entities: 1 of 1
xxx entities are selected.

 

 

Message 3 of 20
gpcattaneo
in reply to: F.Camargo
Message 4 of 20
F.Camargo
in reply to: 3wood

Thank for the quick replay guys!

 

@3wood

I didn't get it the code. Sorry...

Message 5 of 20
F.Camargo
in reply to: gpcattaneo

@gp 

 

Thank you very much for the code. It's just amazing, you helped me a lot.

I'd like to insert a text with the total of polylines. Could you help me out, please?


Regards

Message 6 of 20
Kent1Cooper
in reply to: F.Camargo


@F.Camargo wrote:

....

I created a hatch and I'd to know if there is how to count how many square has inside of the perimeter.

....


Will the perimeter always be a rectangle, and will the Hatch pattern always have an origin point at one corner, as in the sample drawing?  If so, since that's a User-defined Hatch, it would be pretty simple to calculate the number of complete squares from the rectangle's size and the Hatch pattern's Spacing.  Even if it wouldn't always have an origin at a corner, I think it would be only a little more complicated to make compensation for that.

Kent Cooper, AIA
Message 7 of 20
F.Camargo
in reply to: Kent1Cooper

Hi Kent,
It was a simple dwg example. The perimeter isn't always be a rectangle, sometimes will a irregular form.
I have to calculate halfs square too.

Thank you
Message 8 of 20
dbroad
in reply to: F.Camargo

You've gotten some pretty good help.  If your real goal is estimating, get the area of the boundary and divide by the area of a single hatch square.  If you goal is counting how many parts, then others have already posted great solutions.

Architect, Registered NC, VA, SC, & GA.
Message 9 of 20
gpcattaneo
in reply to: F.Camargo

F.Camargo, try this:

 

 

 

488.gif

Message 10 of 20
F.Camargo
in reply to: gpcattaneo

Thank you very much gp.
I'm really happy with the goal 🙂

I don't want to take advantage of your willingness. would you mind to improve the code to count half squares too?
e.g
26 squares created
35 half squares

Regards
Message 11 of 20
3wood
in reply to: F.Camargo

When you use SMARTSEL, with WP option, the number of block/square polyline you selected are full squares. Then use CP option to select again. The different between CP and WP is the "half" square number (less than a full square).

Message 12 of 20
gpcattaneo
in reply to: F.Camargo


@F.Camargo wrote:
Thank you very much gp.......................
I don't want to take advantage of your willingness. would you mind to improve the code to count half squares too?
e.g
26 squares created
35 half squares

You're welcome.

 

Try this:

Message 13 of 20
F.Camargo
in reply to: 3wood

Hi 3wood

Thank you very much for the help.

I really appreciated your help.  🙂

 

Message 14 of 20
F.Camargo
in reply to: gpcattaneo

Hi gp,

The code isn't count the halves squares.

 

I attached the file example.

 

 

Thank in advance

Message 15 of 20
gpcattaneo
in reply to: F.Camargo


@F.Camargo wrote:

The code isn't count the halves squares.


 

Your boundary is a polyline.

Message 16 of 20
F.Camargo
in reply to: gpcattaneo


@gpcattaneo wrote:

@F.Camargo wrote:

The code isn't count the halves squares.


 

Your boundary is a polyline.


 

yes, I make boundary in red to represent halves squares.

I'd like to know if is possible to count that halves squares too.

 

 

Message 17 of 20
gpcattaneo
in reply to: F.Camargo

Just explode the polyline, lisp work on lines.

 

491.jpg

 

Message 18 of 20
F.Camargo
in reply to: gpcattaneo

Perfect gp!

 

Thank you very much for the help.

 

I'm really satisfied with the goal. 🙂

Message 19 of 20
3wood
in reply to: F.Camargo

Some images for better understanding how to use SMARTSEL to do the counting task:

Step 1, Create array of square blocks or polylines to cover an area bigger than the boundary line. Then explode the array object.

Step 2, Use SMARTSEL, WP option to select all whole blocks inside the boundary. It shows how many entities are selected in the command line.

This number (176 in the example) is the whole square number.

smartsel 11.PNG

Graphic result:

smartsel 1.PNG

 

Step 3, Use SMARTSEL again, CP option to select all blocks inside the boundary and on the boundary. It shows how many entities are selected in the command line.

Graphic result:

smartsel 2.PNG

 

Step 4, Use the result in Step 3 minus the result in Step 2 to get the number of "half" squares. In the example, it is 247-176=71

Message 20 of 20
F.Camargo
in reply to: 3wood

Excellent tutorial!!

 

Thank you very much 🙂

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost