VBA code create hatch existing closed polyline or Rectangular with user size and count full & half shapes

VBA code create hatch existing closed polyline or Rectangular with user size and count full & half shapes

jalal.mousa
Advocate Advocate
957 Views
5 Replies
Message 1 of 6

VBA code create hatch existing closed polyline or Rectangular with user size and count full & half shapes

jalal.mousa
Advocate
Advocate

Hi there, 

 

I am looking for VBA code that can help draw hatch and count full pcs & 1/2 pcs  on top of selected polyline or Rectangular 

i need result of counted pcs to be returned to Excel

code should get user input for size of shape such as 0.3x0.6 and input of angle such as 32.90 degree

see attached screen shot for clarity

is there

0 Likes
Accepted solutions (1)
958 Views
5 Replies
Replies (5)
Message 2 of 6

paullimapa
Mentor
Mentor

you'll get better feedback posting here:

AutoCAD VBA Forum - Autodesk Community


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

jalal.mousa
Advocate
Advocate

thanks

 

0 Likes
Message 4 of 6

Sea-Haven
Mentor
Mentor
Accepted solution

Just a quick answer for this type of count using hatch is probably the wrong way to go, ok shape on angle, use UCS to set angle, draw a title as a rectang use array to cover whole area then erase all outside tiles then can just count rectangs. A double row pattern requires using array a few times. 

SeaHaven_0-1673047291211.png

Dont forget need to cut tiles from a full tile when counting.

0 Likes
Message 5 of 6

jalal.mousa
Advocate
Advocate

thanks for your reply

i know how to solve it in Autocad but, unfortunately i am looking for VBA solution maybe my post was not clear

have a nice day

 

0 Likes
Message 6 of 6

Sea-Haven
Mentor
Mentor

No that is the answer but using VBA, I did concrete house slabs that had waffle panels used the same principal of over drawing an array then trimming the outside. You just have to write it all in VBA. 

 

Ok some hints, the obvious is get the size of rectang and for tiles the grout gap, use UCS to set on angle if required, pick control corner. Pick a window of the object. You need to work out say the max/min X & Y plus 1 tile in each direction, you need to do this for some shapes. So the object is totally covered by tiles. Then erase all not needed, re 1/2 tiles a bit tricky not sure of a quick way. 

 

I can do a little bit in VBA but for me I would just do in lisp as I have done before.

 

PS I did this for my own house reno. Counted tiles including 1/2 tiles.

 

You may have to wait or pay some one if you can not do it yourself.

 

 

0 Likes