Message 1 of 3
Not applicable
02-23-2017
08:09 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I trying to create a function that will take a polyline and apply an offset to it with the condition that the offset is always on the outside of the polyline. The problem I am having is that sometimes the offset is inside the polyline not outside and I cant seem to figure out why. The API docs say that a negative offset would indicate to most objects that the curve should be inside so i would guess that a positive offset would indicate that the curve should be outside. My code is below.
bool createPolylineOffset( AcDbPolyline *polyline, double offset, ACHAR *offsetLayer )
{
Acad::ErrorStatus errorStatus;
AcDbObjectId ownerId;
AcDbVoidPtrArray offsetPolylinePoints;
AcDbPolyline *offsetPolyline;
//Make sure that we are drawing our offset on the outside of the selected polyline
offset = abs( offset );
ownerId = polyline->ownerId();
errorStatus = polyline->getOffsetCurves( offset, offsetPolylinePoints );
if( errorStatus != Acad::eOk )
{
acutPrintf( L"\nError: Could not offset points %s", acadErrorStatusText( errorStatus ) );
return false;
}
if( offsetPolylinePoints.length() != 1 )
{
acutPrintf( L"\nError: Could not get offset points" );
deleteArray( offsetPolylinePoints );
return false;
}
offsetPolyline = (AcDbPolyline*)(offsetPolylinePoints[0]);
offsetPolyline->setLayer(offsetLayer);
appendEntity(offsetPolyline, ownerId);
offsetPolyline->close();
return true;
}
Solved! Go to Solution.

