AutoCAD Land Desktop (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

alignment bounding box

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
366 Views, 3 Replies

alignment bounding box

Hi,

does anyone have an easy way of getting an alignments boundingbox? From what
I've seen so far I will need to loop through all the alignment entities and
draw them, get the drawing entities bounding boxes and compare those to get
the max min values.
Is there a less time consuming way to do this?

thanks,
Coen
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Maybe join the entites together to form a polyline? Then get the bounding
box of that? No sure it would be any easier though.

--
James Wedding
IT Manager
Jones & Boyd, Inc.
Dallas, TX
jwedding@*NOSPAM*jones-boyd.com
Message 3 of 4
Anonymous
in reply to: Anonymous

Coen:

I don't think you need to draw the entities.

You can access the alignment entities within VBA. Each entity has a start
and end northing and easting property.

You would have to loop through each entity and search for the max and min
northings and eastings, but I don't think this would be very difficult:

Dim i as Integer
Dim nmin as double, nmax as double, emin as double, emax as double
Dim als As AeccAlignments, al As AeccAlignment, ae As AeccAlignEntities
Set als = AeccApplication.ActiveProject.Alignments
Set al = als.Item(als.CurrentAlignment)
Set ae = al.AlignEntities

nmin=0 : nmax=0 : emin=0 : emax=0

For i = 0 To ae.Count - 1
If ae.Item(i).StartEasting < emin Then
emin = ae.Item(i).StartEasting
end if
If ae.Item(i).EndEasting < emin Then
emin = ae.Item(i).EndEasting
end if
If ae.Item(i).StartEasting > emax Then
emax = ae.Item(i).StartEasting
end if
If ae.Item(i).EndEasting > emax Then
emin = ae.Item(i).EndEasting
end if
etc
etc
etc
etc

Next

I wrote this real quick. Obviously, test it extensively before using.

Good luck,

Drew Burgasser
CAD Masters, Inc.
www.cadmasters.com


"Coen van Dongen" wrote in message
news:790AC8AD344992002E37A796B93AD67D@in.WebX.maYIadrTaRb...
> Hi,
>
> does anyone have an easy way of getting an alignments boundingbox? From
what
> I've seen so far I will need to loop through all the alignment entities
and
> draw them, get the drawing entities bounding boxes and compare those to
get
> the max min values.
> Is there a less time consuming way to do this?
>
> thanks,
> Coen
>
>
Message 4 of 4
Anonymous
in reply to: Anonymous

If you are looking for the acad x,y bounding box, then you will first need
to convert from northing/easting to x,y with the utility function (I forget
it's name) to account for the dwg Land Desktop north rotation.

The other issue to consider is that a min/max coordinate may be a point
along a curve. To deal with this you would check the start and end
directions to see if they are in two different quadrants. If so, you would
calculate the min or max value depending on which two quadrants the
start/end directions are in. For example, if the start direction is SE and
the end direction is SW then you would want to determine the maximum easting
value for this curve. This could be done a number of ways. One approach
would be to get the radius point, then add the radius value to the easting
to determine the max easting on the curve.

Spirals are more difficult. If you are just looking to create a zoom to
function, then I would include the SPI coordinate (along with the start/end)
in my min/max comparison and call it close enough. If you need to be more
exact, you may need to go the route of creating the spirals in the drawing
and using acad to determine the bounding box.

Glen



"Drew Burgasser" wrote in message
news:41E38059244E7A66D90AEFE76460CB18@in.WebX.maYIadrTaRb...
> Coen:
>
> I don't think you need to draw the entities.
>
> You can access the alignment entities within VBA. Each entity has a start
> and end northing and easting property.
>
> You would have to loop through each entity and search for the max and min
> northings and eastings, but I don't think this would be very difficult:
>
> Dim i as Integer
> Dim nmin as double, nmax as double, emin as double, emax as double
> Dim als As AeccAlignments, al As AeccAlignment, ae As AeccAlignEntities
> Set als = AeccApplication.ActiveProject.Alignments
> Set al = als.Item(als.CurrentAlignment)
> Set ae = al.AlignEntities
>
> nmin=0 : nmax=0 : emin=0 : emax=0
>
> For i = 0 To ae.Count - 1
> If ae.Item(i).StartEasting < emin Then
> emin = ae.Item(i).StartEasting
> end if
> If ae.Item(i).EndEasting < emin Then
> emin = ae.Item(i).EndEasting
> end if
> If ae.Item(i).StartEasting > emax Then
> emax = ae.Item(i).StartEasting
> end if
> If ae.Item(i).EndEasting > emax Then
> emin = ae.Item(i).EndEasting
> end if
> etc
> etc
> etc
> etc
>
> Next
>
> I wrote this real quick. Obviously, test it extensively before using.
>
> Good luck,
>
> Drew Burgasser
> CAD Masters, Inc.
> www.cadmasters.com
>
>
> "Coen van Dongen" wrote in message
> news:790AC8AD344992002E37A796B93AD67D@in.WebX.maYIadrTaRb...
> > Hi,
> >
> > does anyone have an easy way of getting an alignments boundingbox? From
> what
> > I've seen so far I will need to loop through all the alignment entities
> and
> > draw them, get the drawing entities bounding boxes and compare those to
> get
> > the max min values.
> > Is there a less time consuming way to do this?
> >
> > thanks,
> > Coen
> >
> >
>
>

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

Post to forums  

Autodesk Design & Make Report