<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Can anyone offset a line??? Please help a beginner! in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331741#M43627</link>
    <description>&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;hello,&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I'm new to objectarx, and and have a little &lt;BR /&gt;
problem:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I try to offset a AcDbLine.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;First I create a line, after this&amp;nbsp;I want to &lt;BR /&gt;
offset this line in objectarx about 10cm to the right,&lt;BR /&gt;like the command &lt;BR /&gt;
'offset' in autocad do.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;How do I figure out the new points of the new &lt;BR /&gt;
line?&lt;BR /&gt;The code below, that's how far I came.&lt;BR /&gt;Is that the the right way or &lt;BR /&gt;
is there a better way of doing this?&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;thanks for help&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;chris&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;ads_point pt1, pt2;&lt;BR /&gt;int &lt;BR /&gt;
retval;&lt;BR /&gt;Acad::ErrorStatus es;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;try &lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;// get the first point &lt;BR /&gt;
from the user.&amp;nbsp; Do not specify a base point.&lt;BR /&gt;&amp;nbsp;//...&lt;BR /&gt;&amp;nbsp;if &lt;BR /&gt;
((retval = acedGetPoint(NULL, LoadMyResourceString(IDS_STRING101), pt1)) != &lt;BR /&gt;
RTNORM) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;throw retval;&lt;BR /&gt;&amp;nbsp;// get the second point from the &lt;BR /&gt;
user, using the first point as a base point.&lt;BR /&gt;&amp;nbsp;//...&lt;BR /&gt;&amp;nbsp;if ((retval &lt;BR /&gt;
= acedGetPoint(pt1, LoadMyResourceString(IDS_STRING102), pt2)) != &lt;BR /&gt;
RTNORM)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;throw retval;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;catch (int &lt;BR /&gt;
e)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;if (e == RTCAN)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return &lt;BR /&gt;
Acad::eUserBreak;&lt;BR /&gt;&amp;nbsp;if (e == RTERROR)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return &lt;BR /&gt;
Acad::eInvalidInput;&lt;BR /&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;// Instantiate an AcDbLine pointer.&amp;nbsp; Use the &lt;BR /&gt;
two user-chosen &lt;BR /&gt;// points as endpoints.&lt;BR /&gt;// Since AcDbLine's constructor &lt;BR /&gt;
uses AcGePoint2d, but acedGetPoint returns ads_point,&lt;BR /&gt;// you must find a way &lt;BR /&gt;
to translate old style to new style.&amp;nbsp; This can be done either by&lt;BR /&gt;// &lt;BR /&gt;
assigning each array member individually, or by calling asPnt3d() from &lt;BR /&gt;
geassign.h&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;AcDbLine* pLine = new AcDbLine(asPnt3d(pt1), &lt;BR /&gt;
asPnt3d(pt2));&lt;BR /&gt;// Make sure you created the line...&lt;BR /&gt;if &lt;BR /&gt;
(!pLine)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;acedAlert(LoadMyResourceString(IDS_STRING103));&lt;BR /&gt;&amp;nbsp;return &lt;BR /&gt;
Acad::eOutOfMemory;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;// change the color property of the new line &lt;BR /&gt;
to this value.&lt;BR /&gt;int color = 2;&lt;BR /&gt;pLine-&amp;gt;setColorIndex(color);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;// Post the new entity to the &lt;BR /&gt;
database&lt;BR /&gt;AcDbObjectId id;&lt;BR /&gt;postToDb(pLine, id);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;pLine-&amp;gt;close();&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;//Get the new coordinates of the new &lt;BR /&gt;
points&lt;BR /&gt;AcGeMatrix3d xform;&lt;BR /&gt;AcDbEntity* pEnt;&lt;BR /&gt;AcGeVector3d &lt;BR /&gt;
axis;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;if (acdbOpenObject(pEnt, id, AcDb::kForRead) != &lt;BR /&gt;
Acad::eOk)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;id-&amp;gt;close();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;BR /&gt;
Acad::eNullEntityPointer;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;id-&amp;gt;close();&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;AcGeMatrix3d &lt;BR /&gt;
ecsMat;&lt;BR /&gt;pEnt-&amp;gt;getEcs(ecsMat);&lt;BR /&gt;AcGePoint3d origin;&lt;BR /&gt;AcGeVector3d &lt;BR /&gt;
xAxis;&lt;BR /&gt;AcGeVector3d yAxis;&lt;BR /&gt;ecsMat.getCoordSystem(origin, xAxis, yAxis, &lt;BR /&gt;
axis);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;BR /&gt;xform.setToRotation(-90.0, axis, ucsToWcs(asPnt3d(pt1)));&lt;BR /&gt;es = &lt;BR /&gt;
pEnt-&amp;gt;upgradeOpen();&lt;BR /&gt;&amp;nbsp;if (es == &lt;BR /&gt;
Acad::eOk)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;es = &lt;BR /&gt;
pEnt-&amp;gt;transformBy(xform);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;if (es != &lt;BR /&gt;
Acad::eOk)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Acad::eNotApplicable;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;pEnt-&amp;gt;close();&lt;BR /&gt;&lt;/DIV&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 15 Nov 2001 07:30:54 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2001-11-15T07:30:54Z</dc:date>
    <item>
      <title>Can anyone offset a line??? Please help a beginner!</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331741#M43627</link>
      <description>&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;hello,&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I'm new to objectarx, and and have a little &lt;BR /&gt;
problem:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;I try to offset a AcDbLine.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;First I create a line, after this&amp;nbsp;I want to &lt;BR /&gt;
offset this line in objectarx about 10cm to the right,&lt;BR /&gt;like the command &lt;BR /&gt;
'offset' in autocad do.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;How do I figure out the new points of the new &lt;BR /&gt;
line?&lt;BR /&gt;The code below, that's how far I came.&lt;BR /&gt;Is that the the right way or &lt;BR /&gt;
is there a better way of doing this?&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;thanks for help&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;chris&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;ads_point pt1, pt2;&lt;BR /&gt;int &lt;BR /&gt;
retval;&lt;BR /&gt;Acad::ErrorStatus es;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;try &lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;// get the first point &lt;BR /&gt;
from the user.&amp;nbsp; Do not specify a base point.&lt;BR /&gt;&amp;nbsp;//...&lt;BR /&gt;&amp;nbsp;if &lt;BR /&gt;
((retval = acedGetPoint(NULL, LoadMyResourceString(IDS_STRING101), pt1)) != &lt;BR /&gt;
RTNORM) &lt;BR /&gt;&amp;nbsp;&amp;nbsp;throw retval;&lt;BR /&gt;&amp;nbsp;// get the second point from the &lt;BR /&gt;
user, using the first point as a base point.&lt;BR /&gt;&amp;nbsp;//...&lt;BR /&gt;&amp;nbsp;if ((retval &lt;BR /&gt;
= acedGetPoint(pt1, LoadMyResourceString(IDS_STRING102), pt2)) != &lt;BR /&gt;
RTNORM)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;throw retval;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;catch (int &lt;BR /&gt;
e)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;if (e == RTCAN)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return &lt;BR /&gt;
Acad::eUserBreak;&lt;BR /&gt;&amp;nbsp;if (e == RTERROR)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;return &lt;BR /&gt;
Acad::eInvalidInput;&lt;BR /&gt;&amp;nbsp;}&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;// Instantiate an AcDbLine pointer.&amp;nbsp; Use the &lt;BR /&gt;
two user-chosen &lt;BR /&gt;// points as endpoints.&lt;BR /&gt;// Since AcDbLine's constructor &lt;BR /&gt;
uses AcGePoint2d, but acedGetPoint returns ads_point,&lt;BR /&gt;// you must find a way &lt;BR /&gt;
to translate old style to new style.&amp;nbsp; This can be done either by&lt;BR /&gt;// &lt;BR /&gt;
assigning each array member individually, or by calling asPnt3d() from &lt;BR /&gt;
geassign.h&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;AcDbLine* pLine = new AcDbLine(asPnt3d(pt1), &lt;BR /&gt;
asPnt3d(pt2));&lt;BR /&gt;// Make sure you created the line...&lt;BR /&gt;if &lt;BR /&gt;
(!pLine)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;acedAlert(LoadMyResourceString(IDS_STRING103));&lt;BR /&gt;&amp;nbsp;return &lt;BR /&gt;
Acad::eOutOfMemory;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;// change the color property of the new line &lt;BR /&gt;
to this value.&lt;BR /&gt;int color = 2;&lt;BR /&gt;pLine-&amp;gt;setColorIndex(color);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;// Post the new entity to the &lt;BR /&gt;
database&lt;BR /&gt;AcDbObjectId id;&lt;BR /&gt;postToDb(pLine, id);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;pLine-&amp;gt;close();&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;//Get the new coordinates of the new &lt;BR /&gt;
points&lt;BR /&gt;AcGeMatrix3d xform;&lt;BR /&gt;AcDbEntity* pEnt;&lt;BR /&gt;AcGeVector3d &lt;BR /&gt;
axis;&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;if (acdbOpenObject(pEnt, id, AcDb::kForRead) != &lt;BR /&gt;
Acad::eOk)&lt;BR /&gt;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;id-&amp;gt;close();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return &lt;BR /&gt;
Acad::eNullEntityPointer;&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;id-&amp;gt;close();&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;AcGeMatrix3d &lt;BR /&gt;
ecsMat;&lt;BR /&gt;pEnt-&amp;gt;getEcs(ecsMat);&lt;BR /&gt;AcGePoint3d origin;&lt;BR /&gt;AcGeVector3d &lt;BR /&gt;
xAxis;&lt;BR /&gt;AcGeVector3d yAxis;&lt;BR /&gt;ecsMat.getCoordSystem(origin, xAxis, yAxis, &lt;BR /&gt;
axis);&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;BR /&gt;xform.setToRotation(-90.0, axis, ucsToWcs(asPnt3d(pt1)));&lt;BR /&gt;es = &lt;BR /&gt;
pEnt-&amp;gt;upgradeOpen();&lt;BR /&gt;&amp;nbsp;if (es == &lt;BR /&gt;
Acad::eOk)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;es = &lt;BR /&gt;
pEnt-&amp;gt;transformBy(xform);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;if (es != &lt;BR /&gt;
Acad::eOk)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return Acad::eNotApplicable;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;pEnt-&amp;gt;close();&lt;BR /&gt;&lt;/DIV&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Nov 2001 07:30:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331741#M43627</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-11-15T07:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can anyone offset a line??? Please help a beginner!</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331742#M43628</link>
      <description>How about this (just add error checking...):&lt;BR /&gt;
&lt;BR /&gt;
Once you have created the line, let AutoCAD do the work for you!&lt;BR /&gt;
&lt;BR /&gt;
{...}&lt;BR /&gt;
double dist = 10.0;&lt;BR /&gt;
AcDbVoidPtrArray ents;&lt;BR /&gt;
pLine-&amp;gt;getOffsetCurves(dist, ents);&lt;BR /&gt;
&lt;BR /&gt;
// There should only be one, but call me superstitious...&lt;BR /&gt;
for (int i=0; i &amp;lt; ents.length(); i++)&lt;BR /&gt;
{&lt;BR /&gt;
    AcDbEntity *pEnt = ((AcRxObject*)(ents&lt;I&gt;));&lt;BR /&gt;
    if (i=0)&lt;BR /&gt;
    {&lt;BR /&gt;
        postToDb(pEnt, id);&lt;BR /&gt;
        pEnt-&amp;gt;close();&lt;BR /&gt;
    }&lt;BR /&gt;
    else&lt;BR /&gt;
        delete pEnt;&lt;BR /&gt;
}&lt;BR /&gt;
{...}&lt;BR /&gt;
&lt;BR /&gt;
"C. Marx" &lt;MARX_SOFTWARE&gt; wrote in message&lt;BR /&gt;
news:47D88617725EEDFACEBD1CE93555A76B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm new to objectarx, and and have a little problem:&lt;BR /&gt;
&lt;BR /&gt;
I try to offset a AcDbLine.&lt;BR /&gt;
First I create a line, after this I want to offset this line in objectarx&lt;BR /&gt;
about 10cm to the right,&lt;BR /&gt;
like the command 'offset' in autocad do.&lt;BR /&gt;
How do I figure out the new points of the new line?&lt;BR /&gt;
The code below, that's how far I came.&lt;BR /&gt;
Is that the the right way or is there a better way of doing this?&lt;BR /&gt;
&lt;BR /&gt;
thanks for help&lt;BR /&gt;
&lt;BR /&gt;
chris&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ads_point pt1, pt2;&lt;BR /&gt;
int retval;&lt;BR /&gt;
Acad::ErrorStatus es;&lt;BR /&gt;
&lt;BR /&gt;
try&lt;BR /&gt;
 {&lt;BR /&gt;
 // get the first point from the user.  Do not specify a base point.&lt;BR /&gt;
 //...&lt;BR /&gt;
 if ((retval = acedGetPoint(NULL, LoadMyResourceString(IDS_STRING101), pt1))&lt;BR /&gt;
!= RTNORM)&lt;BR /&gt;
  throw retval;&lt;BR /&gt;
 // get the second point from the user, using the first point as a base&lt;BR /&gt;
point.&lt;BR /&gt;
 //...&lt;BR /&gt;
 if ((retval = acedGetPoint(pt1, LoadMyResourceString(IDS_STRING102), pt2))&lt;BR /&gt;
!= RTNORM)&lt;BR /&gt;
  throw retval;&lt;BR /&gt;
 }&lt;BR /&gt;
catch (int e)&lt;BR /&gt;
 {&lt;BR /&gt;
 if (e == RTCAN)&lt;BR /&gt;
  return Acad::eUserBreak;&lt;BR /&gt;
 if (e == RTERROR)&lt;BR /&gt;
  return Acad::eInvalidInput;&lt;BR /&gt;
 }&lt;BR /&gt;
&lt;BR /&gt;
// Instantiate an AcDbLine pointer.  Use the two user-chosen&lt;BR /&gt;
// points as endpoints.&lt;BR /&gt;
// Since AcDbLine's constructor uses AcGePoint2d, but acedGetPoint returns&lt;BR /&gt;
ads_point,&lt;BR /&gt;
// you must find a way to translate old style to new style.  This can be&lt;BR /&gt;
done either by&lt;BR /&gt;
// assigning each array member individually, or by calling asPnt3d() from&lt;BR /&gt;
geassign.h&lt;BR /&gt;
&lt;BR /&gt;
AcDbLine* pLine = new AcDbLine(asPnt3d(pt1), asPnt3d(pt2));&lt;BR /&gt;
// Make sure you created the line...&lt;BR /&gt;
if (!pLine)&lt;BR /&gt;
 {&lt;BR /&gt;
 acedAlert(LoadMyResourceString(IDS_STRING103));&lt;BR /&gt;
 return Acad::eOutOfMemory;&lt;BR /&gt;
 }&lt;BR /&gt;
// change the color property of the new line to this value.&lt;BR /&gt;
int color = 2;&lt;BR /&gt;
pLine-&amp;gt;setColorIndex(color);&lt;BR /&gt;
&lt;BR /&gt;
// Post the new entity to the database&lt;BR /&gt;
AcDbObjectId id;&lt;BR /&gt;
postToDb(pLine, id);&lt;BR /&gt;
&lt;BR /&gt;
pLine-&amp;gt;close();&lt;BR /&gt;
&lt;BR /&gt;
//Get the new coordinates of the new points&lt;BR /&gt;
AcGeMatrix3d xform;&lt;BR /&gt;
AcDbEntity* pEnt;&lt;BR /&gt;
AcGeVector3d axis;&lt;BR /&gt;
&lt;BR /&gt;
if (acdbOpenObject(pEnt, id, AcDb::kForRead) != Acad::eOk)&lt;BR /&gt;
 {&lt;BR /&gt;
 id-&amp;gt;close();&lt;BR /&gt;
    return Acad::eNullEntityPointer;&lt;BR /&gt;
 }&lt;BR /&gt;
id-&amp;gt;close();&lt;BR /&gt;
&lt;BR /&gt;
AcGeMatrix3d ecsMat;&lt;BR /&gt;
pEnt-&amp;gt;getEcs(ecsMat);&lt;BR /&gt;
AcGePoint3d origin;&lt;BR /&gt;
AcGeVector3d xAxis;&lt;BR /&gt;
AcGeVector3d yAxis;&lt;BR /&gt;
ecsMat.getCoordSystem(origin, xAxis, yAxis, axis);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
xform.setToRotation(-90.0, axis, ucsToWcs(asPnt3d(pt1)));&lt;BR /&gt;
es = pEnt-&amp;gt;upgradeOpen();&lt;BR /&gt;
 if (es == Acad::eOk)&lt;BR /&gt;
  {&lt;BR /&gt;
  es = pEnt-&amp;gt;transformBy(xform);&lt;BR /&gt;
  if (es != Acad::eOk)&lt;BR /&gt;
    return Acad::eNotApplicable;&lt;BR /&gt;
&lt;BR /&gt;
  }&lt;BR /&gt;
pEnt-&amp;gt;close();&lt;/MARX_SOFTWARE&gt;&lt;/I&gt;</description>
      <pubDate>Thu, 15 Nov 2001 07:59:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331742#M43628</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-11-15T07:59:25Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331743#M43629</link>
      <description>Ack!  That's terrible....I should be shot.&lt;BR /&gt;
&lt;BR /&gt;
the first line of the for loop should look like this:&lt;BR /&gt;
     AcDbEntity *pEnt = ((AcDbEntity*)(ents&lt;I&gt;));&lt;BR /&gt;
&lt;BR /&gt;
Hopefully that is safe &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;  If you're superstitious, you may want to use&lt;BR /&gt;
this instead&lt;BR /&gt;
     AcDbEntity *pEnt = AcDbEntity::cast((AcRxObject*)(ents&lt;I&gt;));&lt;BR /&gt;
&lt;BR /&gt;
and then verify that pEnt != NULL before you use it.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Jon&lt;/I&gt;&lt;/I&gt;</description>
      <pubDate>Thu, 15 Nov 2001 08:05:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331743#M43629</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-11-15T08:05:57Z</dc:date>
    </item>
    <item>
      <title>Hi Jon</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331744#M43630</link>
      <description>Thanks for answering me!&lt;BR /&gt;
&lt;BR /&gt;
I check it out and tell you if I succeed.&lt;BR /&gt;
&lt;BR /&gt;
Chris</description>
      <pubDate>Fri, 16 Nov 2001 01:36:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331744#M43630</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-11-16T01:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: Can anyone offset a line??? Please help a beginner!</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331745#M43631</link>
      <description>Okay, this solution is not ARX, but ads. However, it's simple.  Try to run&lt;BR /&gt;
acedCommand() with appropriate string parameters.  That should do the trick.&lt;BR /&gt;
C. Marx &lt;MARX_SOFTWARE&gt; wrote in message&lt;BR /&gt;
news:47D88617725EEDFACEBD1CE93555A76B@in.WebX.maYIadrTaRb...&lt;BR /&gt;
hello,&lt;BR /&gt;
&lt;BR /&gt;
I'm new to objectarx, and and have a little problem:&lt;BR /&gt;
&lt;BR /&gt;
I try to offset a AcDbLine.&lt;BR /&gt;
First I create a line, after this I want to offset this line in objectarx&lt;BR /&gt;
about 10cm to the right,&lt;BR /&gt;
like the command 'offset' in autocad do.&lt;BR /&gt;
How do I figure out the new points of the new line?&lt;BR /&gt;
The code below, that's how far I came.&lt;BR /&gt;
Is that the the right way or is there a better way of doing this?&lt;BR /&gt;
&lt;BR /&gt;
thanks for help&lt;BR /&gt;
&lt;BR /&gt;
chris&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
ads_point pt1, pt2;&lt;BR /&gt;
int retval;&lt;BR /&gt;
Acad::ErrorStatus es;&lt;BR /&gt;
&lt;BR /&gt;
try&lt;BR /&gt;
 {&lt;BR /&gt;
 // get the first point from the user.  Do not specify a base point.&lt;BR /&gt;
 //...&lt;BR /&gt;
 if ((retval = acedGetPoint(NULL, LoadMyResourceString(IDS_STRING101), pt1))&lt;BR /&gt;
!= RTNORM)&lt;BR /&gt;
  throw retval;&lt;BR /&gt;
 // get the second point from the user, using the first point as a base&lt;BR /&gt;
point.&lt;BR /&gt;
 //...&lt;BR /&gt;
 if ((retval = acedGetPoint(pt1, LoadMyResourceString(IDS_STRING102), pt2))&lt;BR /&gt;
!= RTNORM)&lt;BR /&gt;
  throw retval;&lt;BR /&gt;
 }&lt;BR /&gt;
catch (int e)&lt;BR /&gt;
 {&lt;BR /&gt;
 if (e == RTCAN)&lt;BR /&gt;
  return Acad::eUserBreak;&lt;BR /&gt;
 if (e == RTERROR)&lt;BR /&gt;
  return Acad::eInvalidInput;&lt;BR /&gt;
 }&lt;BR /&gt;
&lt;BR /&gt;
// Instantiate an AcDbLine pointer.  Use the two user-chosen&lt;BR /&gt;
// points as endpoints.&lt;BR /&gt;
// Since AcDbLine's constructor uses AcGePoint2d, but acedGetPoint returns&lt;BR /&gt;
ads_point,&lt;BR /&gt;
// you must find a way to translate old style to new style.  This can be&lt;BR /&gt;
done either by&lt;BR /&gt;
// assigning each array member individually, or by calling asPnt3d() from&lt;BR /&gt;
geassign.h&lt;BR /&gt;
&lt;BR /&gt;
AcDbLine* pLine = new AcDbLine(asPnt3d(pt1), asPnt3d(pt2));&lt;BR /&gt;
// Make sure you created the line...&lt;BR /&gt;
if (!pLine)&lt;BR /&gt;
 {&lt;BR /&gt;
 acedAlert(LoadMyResourceString(IDS_STRING103));&lt;BR /&gt;
 return Acad::eOutOfMemory;&lt;BR /&gt;
 }&lt;BR /&gt;
// change the color property of the new line to this value.&lt;BR /&gt;
int color = 2;&lt;BR /&gt;
pLine-&amp;gt;setColorIndex(color);&lt;BR /&gt;
&lt;BR /&gt;
// Post the new entity to the database&lt;BR /&gt;
AcDbObjectId id;&lt;BR /&gt;
postToDb(pLine, id);&lt;BR /&gt;
&lt;BR /&gt;
pLine-&amp;gt;close();&lt;BR /&gt;
&lt;BR /&gt;
//Get the new coordinates of the new points&lt;BR /&gt;
AcGeMatrix3d xform;&lt;BR /&gt;
AcDbEntity* pEnt;&lt;BR /&gt;
AcGeVector3d axis;&lt;BR /&gt;
&lt;BR /&gt;
if (acdbOpenObject(pEnt, id, AcDb::kForRead) != Acad::eOk)&lt;BR /&gt;
 {&lt;BR /&gt;
 id-&amp;gt;close();&lt;BR /&gt;
    return Acad::eNullEntityPointer;&lt;BR /&gt;
 }&lt;BR /&gt;
id-&amp;gt;close();&lt;BR /&gt;
&lt;BR /&gt;
AcGeMatrix3d ecsMat;&lt;BR /&gt;
pEnt-&amp;gt;getEcs(ecsMat);&lt;BR /&gt;
AcGePoint3d origin;&lt;BR /&gt;
AcGeVector3d xAxis;&lt;BR /&gt;
AcGeVector3d yAxis;&lt;BR /&gt;
ecsMat.getCoordSystem(origin, xAxis, yAxis, axis);&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
xform.setToRotation(-90.0, axis, ucsToWcs(asPnt3d(pt1)));&lt;BR /&gt;
es = pEnt-&amp;gt;upgradeOpen();&lt;BR /&gt;
 if (es == Acad::eOk)&lt;BR /&gt;
  {&lt;BR /&gt;
  es = pEnt-&amp;gt;transformBy(xform);&lt;BR /&gt;
  if (es != Acad::eOk)&lt;BR /&gt;
    return Acad::eNotApplicable;&lt;BR /&gt;
&lt;BR /&gt;
  }&lt;BR /&gt;
pEnt-&amp;gt;close();&lt;/MARX_SOFTWARE&gt;</description>
      <pubDate>Fri, 16 Nov 2001 17:52:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/can-anyone-offset-a-line-please-help-a-beginner/m-p/331745#M43631</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2001-11-16T17:52:54Z</dc:date>
    </item>
  </channel>
</rss>

