Getting Entity dxf group 0

Getting Entity dxf group 0

Anonymous
Not applicable
309 Views
5 Replies
Message 1 of 6

Getting Entity dxf group 0

Anonymous
Not applicable
Sorry for such a basic question but I'm just beginning with the ObjectARX -
everything I've been doing so far is with LISP.

Here is the element (along with it's xdata) I'm selecting:

((-1 . ) (0 . "LINE") (330 . )
(5
. "988A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "BEAM") (100 .
"AcDbLine") (10 1272.0 -207.0 0.0) (11 1272.0 -207.0 180.0) (210 0.0 0.0
1.0)
(-3 ("EMD72120xA-34" (1002 . "{") (1000 . "COL") (1040 . -41.0464) (1040 .
22.4) (1070
. 7) (1070 . 12) (1040 . 485.0) (1040 . 485.0) (1040 . 777.0) (1070 . 1)
(1040
. 0.0) (1040 . 0.989204) (1040 . 0.0) (1040 . 0.0) (1040 . 0.0) (1040 . 0.0)
(1040 . -0.989204) (1040 . 0.0) (1040 . -14.8381) (1040 . 0.0) (1040 . 0.0)
(1002 . "}"))))

I figured out how to get the handle (5), startpoint (10), endpoint (11),
layer (8) and all of the xdata that I've attached to it but I can't figure
out how to get the (0 . "LINE") . I want to check before I use

acedEntSel("\nSelect an Entity: ", en, pt);
acdbGetObjectId(eId, en);
acdbOpenObject(pEntity, eId, AcDb::kForRead);
//...here I get the layer, the color and the handle and then close
pEntity...
acdbOpenObject((AcDbObject*&)pLine, eId, AcDb::kForRead);
//...here I get the startpoint and endpoint and then close pLine...
acdbOpenObject(obj, eId, AcDb::kForRead);
//...here I get the xdata

Everything works fine but I must check that the user has selected a "Line"
element before I get the startpoint, endpoint and xdata. If a circle is
selected, startpoint & endpoint have no meaning and the xdata I use is
different.

Thanks in advance,
Ed
0 Likes
310 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
The simplest way is to use an AcDbLine pointer as the first argument to
acdbOpenObject() without casting the pointer to anything else.

AcDbLine *pLine;
acdbOpenObject(pLine, eId, AcDb::kForRead);

That way you'll end up using a version of acdbOpenObject that's
specifically for AcDbLines and won't open anything else (it will return
Acad::eNotThatKindOfClass if the object is not an AcDbLine).


"emdepaola" wrote in message
news:D9E23CFA860F938FA05F14D892300EC0@in.WebX.maYIadrTaRb...
> Sorry for such a basic question but I'm just beginning with the
ObjectARX -
> everything I've been doing so far is with LISP.
>
> Here is the element (along with it's xdata) I'm selecting:
>
> ((-1 . ) (0 . "LINE") (330 .
4006c558>)
> (5
> . "988A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "BEAM") (100
.
> "AcDbLine") (10 1272.0 -207.0 0.0) (11 1272.0 -207.0 180.0) (210 0.0 0.0
> 1.0)
> (-3 ("EMD72120xA-34" (1002 . "{") (1000 . "COL") (1040 . -41.0464) (1040 .
> 22.4) (1070
> . 7) (1070 . 12) (1040 . 485.0) (1040 . 485.0) (1040 . 777.0) (1070 . 1)
> (1040
> . 0.0) (1040 . 0.989204) (1040 . 0.0) (1040 . 0.0) (1040 . 0.0) (1040 .
0.0)
> (1040 . -0.989204) (1040 . 0.0) (1040 . -14.8381) (1040 . 0.0) (1040 .
0.0)
> (1002 . "}"))))
>
> I figured out how to get the handle (5), startpoint (10), endpoint (11),
> layer (8) and all of the xdata that I've attached to it but I can't figure
> out how to get the (0 . "LINE") . I want to check before I use
>
> acedEntSel("\nSelect an Entity: ", en, pt);
> acdbGetObjectId(eId, en);
> acdbOpenObject(pEntity, eId, AcDb::kForRead);
> //...here I get the layer, the color and the handle and then close
> pEntity...
> acdbOpenObject((AcDbObject*&)pLine, eId, AcDb::kForRead);
> //...here I get the startpoint and endpoint and then close pLine...
> acdbOpenObject(obj, eId, AcDb::kForRead);
> //...here I get the xdata
>
> Everything works fine but I must check that the user has selected a "Line"
> element before I get the startpoint, endpoint and xdata. If a circle is
> selected, startpoint & endpoint have no meaning and the xdata I use is
> different.
>
> Thanks in advance,
> Ed
>
>
0 Likes
Message 3 of 6

Anonymous
Not applicable
Art,

Thanks, it worked fine. I used the following code and it returns 46
(eNotThatKindOfClass) if I don't select a line element:

Acad::ErrorStatus retStat;
if((retStat = acdbOpenObject(pLine, eId, AcDb::kForRead)) != Acad::eOk) {
acutPrintf("\nSelected entity is not a line. Error code is %d",
retStat);
return NULL;
}

I have tens of thousands of lines of code (about 75% LISP& DCL and the rest
in ADS) and I'm trying to upgrade everything to ObjectARX including all of
my dialog boxes (hundreds!!!). Although I have some experience with ADS, I
don't want to use the old looping through a resbuf for the information when
Object ARX seems to be much simpler.

I've downloaded the Object ARX development kit from the autodesk site and
installed the wizards. I'm having trouble with the documents (e.g.
"arxref.chm", which simply shut down when I try to use the "Index" or
"Search" tabs. Any ideas?

I bought "Programming AutoCAD 2000 Using Object ARX", Charles McAuley from
Autodesk Press. Can you recommend any other books, downloads or websites?

Thanks again,
Ed



"Art Cooney" wrote in message
news:E3CA952CB453DDE51ED9905D46D5B894@in.WebX.maYIadrTaRb...
> The simplest way is to use an AcDbLine pointer as the first argument to
> acdbOpenObject() without casting the pointer to anything else.
>
> AcDbLine *pLine;
> acdbOpenObject(pLine, eId, AcDb::kForRead);
>
> That way you'll end up using a version of acdbOpenObject that's
> specifically for AcDbLines and won't open anything else (it will return
> Acad::eNotThatKindOfClass if the object is not an AcDbLine).
>
>
> "emdepaola" wrote in message
> news:D9E23CFA860F938FA05F14D892300EC0@in.WebX.maYIadrTaRb...
> > Sorry for such a basic question but I'm just beginning with the
> ObjectARX -
> > everything I've been doing so far is with LISP.
> >
> > Here is the element (along with it's xdata) I'm selecting:
> >
> > ((-1 . ) (0 . "LINE") (330 .
> 4006c558>)
> > (5
> > . "988A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "BEAM")
(100
> .
> > "AcDbLine") (10 1272.0 -207.0 0.0) (11 1272.0 -207.0 180.0) (210 0.0 0.0
> > 1.0)
> > (-3 ("EMD72120xA-34" (1002 . "{") (1000 . "COL") (1040 . -41.0464) (1040
.
> > 22.4) (1070
> > . 7) (1070 . 12) (1040 . 485.0) (1040 . 485.0) (1040 . 777.0) (1070 . 1)
> > (1040
> > . 0.0) (1040 . 0.989204) (1040 . 0.0) (1040 . 0.0) (1040 . 0.0) (1040 .
> 0.0)
> > (1040 . -0.989204) (1040 . 0.0) (1040 . -14.8381) (1040 . 0.0) (1040 .
> 0.0)
> > (1002 . "}"))))
> >
> > I figured out how to get the handle (5), startpoint (10), endpoint (11),
> > layer (8) and all of the xdata that I've attached to it but I can't
figure
> > out how to get the (0 . "LINE") . I want to check before I use
> >
> > acedEntSel("\nSelect an Entity: ", en, pt);
> > acdbGetObjectId(eId, en);
> > acdbOpenObject(pEntity, eId, AcDb::kForRead);
> > //...here I get the layer, the color and the handle and then close
> > pEntity...
> > acdbOpenObject((AcDbObject*&)pLine, eId, AcDb::kForRead);
> > //...here I get the startpoint and endpoint and then close pLine...
> > acdbOpenObject(obj, eId, AcDb::kForRead);
> > //...here I get the xdata
> >
> > Everything works fine but I must check that the user has selected a
"Line"
> > element before I get the startpoint, endpoint and xdata. If a circle is
> > selected, startpoint & endpoint have no meaning and the xdata I use is
> > different.
> >
> > Thanks in advance,
> > Ed
> >
> >
>
>
0 Likes
Message 4 of 6

Anonymous
Not applicable
I've never seen a chm file (arx or otherwise) shut down when trying to use
the index or search tabs. Do you have any other chm files that have nothing
to do with AutoCAD that you can try to see if they work ok? Maybe someone
else has some ideas.

I don't know anything about what books are available these days, but I know
that there are others here in the newsgroup who can help you out with this.
:)

"emdepaola" wrote in message
news:5175F2728CBD30400E61A2404ED7EB16@in.WebX.maYIadrTaRb...
> Art,
>
> Thanks, it worked fine. I used the following code and it returns 46
> (eNotThatKindOfClass) if I don't select a line element:
>
> Acad::ErrorStatus retStat;
> if((retStat = acdbOpenObject(pLine, eId, AcDb::kForRead)) != Acad::eOk)
{
> acutPrintf("\nSelected entity is not a line. Error code is %d",
> retStat);
> return NULL;
> }
>
> I have tens of thousands of lines of code (about 75% LISP& DCL and the
rest
> in ADS) and I'm trying to upgrade everything to ObjectARX including all of
> my dialog boxes (hundreds!!!). Although I have some experience with ADS,
I
> don't want to use the old looping through a resbuf for the information
when
> Object ARX seems to be much simpler.
>
> I've downloaded the Object ARX development kit from the autodesk site and
> installed the wizards. I'm having trouble with the documents (e.g.
> "arxref.chm", which simply shut down when I try to use the "Index" or
> "Search" tabs. Any ideas?
>
> I bought "Programming AutoCAD 2000 Using Object ARX", Charles McAuley from
> Autodesk Press. Can you recommend any other books, downloads or websites?
>
> Thanks again,
> Ed
>
>
>
> "Art Cooney" wrote in message
> news:E3CA952CB453DDE51ED9905D46D5B894@in.WebX.maYIadrTaRb...
> > The simplest way is to use an AcDbLine pointer as the first argument to
> > acdbOpenObject() without casting the pointer to anything else.
> >
> > AcDbLine *pLine;
> > acdbOpenObject(pLine, eId, AcDb::kForRead);
> >
> > That way you'll end up using a version of acdbOpenObject that's
> > specifically for AcDbLines and won't open anything else (it will return
> > Acad::eNotThatKindOfClass if the object is not an AcDbLine).
> >
> >
> > "emdepaola" wrote in message
> > news:D9E23CFA860F938FA05F14D892300EC0@in.WebX.maYIadrTaRb...
> > > Sorry for such a basic question but I'm just beginning with the
> > ObjectARX -
> > > everything I've been doing so far is with LISP.
> > >
> > > Here is the element (along with it's xdata) I'm selecting:
> > >
> > > ((-1 . ) (0 . "LINE") (330 .
> > 4006c558>)
> > > (5
> > > . "988A") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "BEAM")
> (100
> > .
> > > "AcDbLine") (10 1272.0 -207.0 0.0) (11 1272.0 -207.0 180.0) (210 0.0
0.0
> > > 1.0)
> > > (-3 ("EMD72120xA-34" (1002 . "{") (1000 . "COL") (1040 . -41.0464)
(1040
> .
> > > 22.4) (1070
> > > . 7) (1070 . 12) (1040 . 485.0) (1040 . 485.0) (1040 . 777.0) (1070 .
1)
> > > (1040
> > > . 0.0) (1040 . 0.989204) (1040 . 0.0) (1040 . 0.0) (1040 . 0.0) (1040
.
> > 0.0)
> > > (1040 . -0.989204) (1040 . 0.0) (1040 . -14.8381) (1040 . 0.0) (1040 .
> > 0.0)
> > > (1002 . "}"))))
> > >
> > > I figured out how to get the handle (5), startpoint (10), endpoint
(11),
> > > layer (8) and all of the xdata that I've attached to it but I can't
> figure
> > > out how to get the (0 . "LINE") . I want to check before I use
> > >
> > > acedEntSel("\nSelect an Entity: ", en, pt);
> > > acdbGetObjectId(eId, en);
> > > acdbOpenObject(pEntity, eId, AcDb::kForRead);
> > > //...here I get the layer, the color and the handle and then close
> > > pEntity...
> > > acdbOpenObject((AcDbObject*&)pLine, eId, AcDb::kForRead);
> > > //...here I get the startpoint and endpoint and then close pLine...
> > > acdbOpenObject(obj, eId, AcDb::kForRead);
> > > //...here I get the xdata
> > >
> > > Everything works fine but I must check that the user has selected a
> "Line"
> > > element before I get the startpoint, endpoint and xdata. If a circle
is
> > > selected, startpoint & endpoint have no meaning and the xdata I use is
> > > different.
> > >
> > > Thanks in advance,
> > > Ed
> > >
> > >
> >
> >
>
>
0 Likes
Message 5 of 6

Anonymous
Not applicable
>>Can you recommend any other books, downloads or websites?

www.autodesk.com/developautocad is a good starting point for resources
(although you've probably found most of them already).

You might consider joining the Autodesk Developer Network
(www.autodesk.com/adn) or attending one of our ObjectARX training classes
(www.autodesk.com/apitraining). And there are a couple of books listed on
amazon (including Charles' one).

Cheers,

Stephen Preston
Developer Technical Services
Autodesk
http://adn.autodesk.com
0 Likes
Message 6 of 6

Anonymous
Not applicable
Stephen,

Thanks, I"ll look into everything you've suggested. The training is
difficult because it's always in Californnia (I'm in NYC). Any chance of
classes on the East Coast?

Thanks again,
Ed


"Stephen Preston" wrote in message
news:7A1829F8FA2B51E4F3BE07A865388761@in.WebX.maYIadrTaRb...
> >>Can you recommend any other books, downloads or websites?
>
> www.autodesk.com/developautocad is a good starting point for resources
> (although you've probably found most of them already).
>
> You might consider joining the Autodesk Developer Network
> (www.autodesk.com/adn) or attending one of our ObjectARX training classes
> (www.autodesk.com/apitraining). And there are a couple of books listed on
> amazon (including Charles' one).
>
> Cheers,
>
> Stephen Preston
> Developer Technical Services
> Autodesk
> http://adn.autodesk.com
>
>
0 Likes