.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with Offset Line

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
498 Views, 4 Replies

Help with Offset Line

Hello,

I'm fairly new to AutoCAD.NET programming (about 1 year) and need some help.

I have created a command that will draw two arcs (one is a clone of the
other) and then it draws a line from each starting point, then another line
from each ending point, basicly closing the object.

What I would like to do know is offset the lines a specified distance via
user input. I can get the user specified distance, but cannot figure out how
to offest the lines.

Any help would be greatly appreciated.

Thanks,
James Walker
4 REPLIES 4
Message 2 of 5
chiefbraincloud
in reply to: Anonymous

Dim offobjs As DBObjectCollection
offobjs = poly.GetOffsetCurves(-1 * Dist)

In my case poly is a Polyline of course, but the GetOffsetCurves function is available to all objects that derive from Curve, which includes arcs and lines.

The trick is to figure out whether to make the distance parameter positive or negative. This is from the ARX help file.

This function creates one or more entities that together make up the result of offsetting the curve by the distance offsetDist. For many curves, the result is a single new curve. (This single new curve may not be of the same class as the original curve. For example, offsetting an AcDbEllipse results in an AcDbSpline, since the result of offsetting an ellipse does NOT fit the equation of an ellipse.)

...........

If the offsetDist value is negative, it is usually interpreted as being an offset to make a smaller curve (that is, for an arc it would offset to a radius that is offsetDist less than the starting curve's radius). If the negative value has no meaning in terms of making the curve smaller, a negative offsetDist may be interpreted as an offset in the direction of smaller X,Y,Z WCS coordinates. This is not enforced, so custom entities can interpret the sign of the offsetDist value however they want.

The entities returned in the offsetCurves array are dynamically allocated, but have not been added to a Database yet. So, the application that calls this function is responsible for their memory. If they are subsequently appended to a database, then the database takes over responsibility for their memory. Otherwise, the application is responsible for deleting them when they are no longer needed.
Dave O.                                                                  Sig-Logos32.png
Message 3 of 5
Anonymous
in reply to: Anonymous

Thanks for helping with the offset, I have that working.

Would like to know if there is a way to "convert" the offset line in the
DBObjectCollection into a Line? This way I could use the .StartPoint or
.EndPoint to draw lines to or frome the newly offset line.

James Walker



"chiefbraincloud" wrote in message news:6327325@discussion.autodesk.com...
Dim offobjs As DBObjectCollection
offobjs = poly.GetOffsetCurves(-1 * Dist)

In my case poly is a Polyline of course, but the GetOffsetCurves function is
available to all objects that derive from Curve, which includes arcs and
lines.

The trick is to figure out whether to make the distance parameter positive
or negative. This is from the ARX help file.

This function creates one or more entities that together make up the result
of offsetting the curve by the distance offsetDist. For many curves, the
result is a single new curve. (This single new curve may not be of the same
class as the original curve. For example, offsetting an AcDbEllipse results
in an AcDbSpline, since the result of offsetting an ellipse does NOT fit the
equation of an ellipse.)

...........

If the offsetDist value is negative, it is usually interpreted as being an
offset to make a smaller curve (that is, for an arc it would offset to a
radius that is offsetDist less than the starting curve's radius). If the
negative value has no meaning in terms of making the curve smaller, a
negative offsetDist may be interpreted as an offset in the direction of
smaller X,Y,Z WCS coordinates. This is not enforced, so custom entities can
interpret the sign of the offsetDist value however they want.

The entities returned in the offsetCurves array are dynamically allocated,
but have not been added to a Database yet. So, the application that calls
this function is responsible for their memory. If they are subsequently
appended to a database, then the database takes over responsibility for
their memory. Otherwise, the application is responsible for deleting them
when they are no longer needed.
Message 4 of 5
chiefbraincloud
in reply to: Anonymous

If all you need is Startpoint/Endpoint, then you can cast them to Curve.

In VB you can just set a variable declared as Curve = to the DBObject

For Each crv as Curve in offobjs
p1 = crv.StartPoint
...etc.
Next

If you need a parameter that is specific to the object type, like the radius of an arc, for instance, then you have to cast it to the right object type.
Dave O.                                                                  Sig-Logos32.png
Message 5 of 5
chiefbraincloud
in reply to: Anonymous

There it goes duplicate posting again...
Edited by: chiefbraincloud on Feb 1, 2010 11:38 AM
Dave O.                                                                  Sig-Logos32.png

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost