Simple automated line drawing

Simple automated line drawing

Anonymous
Not applicable
620 Views
4 Replies
Message 1 of 5

Simple automated line drawing

Anonymous
Not applicable
Hello everyone, this is my first post so try to go easy on me 😉

I have what I hope is a very simple request, I would like to create a macro
that works like the following;

- I execute this custom command
- It asks me to choose a rectangle
- It draws 2 lines in the rectangle on the current layer, from corner to
corner, forming an "X"

That's it. It would be great if I could further automate it so that it could
accept multiple rectangles and then fill each one of them in sequence. This
sounds weird I'm sure, but it's something I have to do on a VERY repetivie
basis, and it would be great to automate.

I did some VBA coding for Excel years ago, but I am basically clueless on
where to start here. Thanks very much for your help!

-C
0 Likes
621 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Hi,

The pseudo code you need is:

Select an object from the drawing
Check the type of object: AutoCAD has three types of polyline and you have
to handle them slightly differently
If LW polyline
Get its coordinates:
Set a start point to coordinates (0) and (1)
Set an end point to coordinates (4) and (5)
Draw a line from start to end
Set a start point to coordinates (2) and (3)
Set an end point to coordinates (6) and (7)
Draw a line from start to end
If normal or 3D polyline
Get its coordinates: (in this case every third coordinate is an elevation
value)
Set a start point to coordinates (0) and (1)
Set an end point to coordinates (6) and (7)
Draw a line from start to end
Set a start point to coordinates (3) and (4)
Set an end point to coordinates (9) and (10)
Draw a line from start to end

If you make the processing code a sub routine then processing multiples is
very easy
Select a collection of objects from drawing with filter to be polylines only
For each polyline in collection run sub routine
Delete Collection item in your code

All the code you need to do this can be found in the sample code in the help
system and/or by searching this newsgroup


--

Laurie Comerford
CADApps
www.cadapps.com.au
www.civil3Dtools.com
"Carson Christian" wrote in message
news:[email protected]...
Hello everyone, this is my first post so try to go easy on me 😉

I have what I hope is a very simple request, I would like to create a macro
that works like the following;

- I execute this custom command
- It asks me to choose a rectangle
- It draws 2 lines in the rectangle on the current layer, from corner to
corner, forming an "X"

That's it. It would be great if I could further automate it so that it could
accept multiple rectangles and then fill each one of them in sequence. This
sounds weird I'm sure, but it's something I have to do on a VERY repetivie
basis, and it would be great to automate.

I did some VBA coding for Excel years ago, but I am basically clueless on
where to start here. Thanks very much for your help!

-C
0 Likes
Message 3 of 5

Anonymous
Not applicable
Try this one

~'J'~
0 Likes
Message 4 of 5

Anonymous
Not applicable
Here's some code that ~'J'~ helped me with that I converted to do what
you're asking for in vlisp if you can use that.
0 Likes
Message 5 of 5

Anonymous
Not applicable
Thanks a lot folks, I'll look at this stuff over the weekend. Much
appreciated!

-C

wrote in message news:[email protected]...
Try this one

~'J'~
0 Likes