ObjectARX

Reply
*Van Ausdall, Steve
Message 1 of 7 (225 Views)

IPropertyManager example

225 Views, 6 Replies
12-19-2001 08:52 AM
Hi,

I've been looking around for examples of using the IPropertyManager
to retrieve custom properties from entities, but can't seem to
find any. Can anyone help?

Thanks,
Steve
*Schlingheider, J.
Message 2 of 7 (225 Views)

Re: IPropertyManager example

12-27-2001 04:29 PM in reply to: *Van Ausdall, Steve
Hi Steve,
here's a sample for the creation of Properties with the help of
IPropertyManager. The property manager acts as a container for your dynamic
properties and handles them.
You can create your dynamic properties with the objarx wizard, which creates
a propertyadmin, which you don't need explicitly. What I did was to use the
wizard to get proper properties classes, delete the admin and handle the
dynprops within my custom objects like in the sample. I encountered a
problem of Acad by trying to use dynamic props for custom classes directly.
Here you have to use custom object COM wrappers otherwise acopm will get
confused and mixes up the properties of different classes.
Hope to help
Joerg

Sample code:

long CMyClass::setProps()
{
CComPtr mm_pPropMan;
XLinieProperty *mm_newProp = NULL; //My dynamic property
long mm_ct = -1;

mm_pPropMan = GET_OPMPROPERTY_MANAGER(this->isA());
if (mm_pPropMan != NULL)
{
mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
}
//create only if not already done...
if (0 != mm_ct) return mm_ct;

//Create a custom dynamic property
if SUCCEEDED( XLinieProperty::CreateInstance( &mm_newProp ))
{
mm_newProp->AddRef();
//Fill up the attributes of the dynamic property (depends on your
implementation of your dynprop)
mm_newProp->SetCategory("Line-Props");
mm_newProp->SetCategoryId( 0 );
mm_newProp->SetCaption("Name");
mm_newProp->setNumber(-1);
mm_newProp->SetEditable(true);
mm_newProp->setType(VT_BSTR);
//add it to the propman
_com_util::CheckError(mm_pPropMan->AddProperty( mm_newProp ));
mm_ct++;
}
...
return mm_ct;
}

Steve Van Ausdall schrieb in im Newsbeitrag:
51994ABFC0E0D3976839D08732916C16@in.WebX.maYIadrTaRb...
> Hi,
>
> I've been looking around for examples of using the IPropertyManager
> to retrieve custom properties from entities, but can't seem to
> find any. Can anyone help?
>
> Thanks,
> Steve
>
>
>
*Van Ausdall, Steve
Message 3 of 7 (225 Views)

Re:

12-31-2001 09:22 AM in reply to: *Van Ausdall, Steve
Thanks, Joerg!

I'm actually trying to get properties from entities that someone else wrote.
The property I want does show up in the property panel. Is there some other
way to get values to appear there? Could you see if I'm doing something
stupid? I have the following so far - but mm_ct is always set to 0.

#include
...
AcDbEntity *pEnt;
AcDbObjectId oObjId;
IPropertyManager *mm_pPropMan;
...
acdbOpenObject(pEnt, oObjId, AcDb::kForRead);
mm_pPropMan = GET_OPMPROPERTY_MANAGER(pEnt->isA());
mm_pPropMan->GetDynamicPropertyCount(&mm_ct);

Thanks again,
Steve


"J. Schlingheider" wrote in message
news:smileyvery-happy:5A247625F8C842C878B951F458479BD@in.WebX.maYIadrTaRb...
> Hi Steve,
> here's a sample for the creation of Properties with the help of
> IPropertyManager. The property manager acts as a container for your
dynamic
> properties and handles them.
> You can create your dynamic properties with the objarx wizard, which
creates
> a propertyadmin, which you don't need explicitly. What I did was to use
the
> wizard to get proper properties classes, delete the admin and handle the
> dynprops within my custom objects like in the sample. I encountered a
> problem of Acad by trying to use dynamic props for custom classes
directly.
> Here you have to use custom object COM wrappers otherwise acopm will get
> confused and mixes up the properties of different classes.
> Hope to help
> Joerg
>
> Sample code:
>
> long CMyClass::setProps()
> {
> CComPtr mm_pPropMan;
> XLinieProperty *mm_newProp = NULL; //My dynamic property
> long mm_ct = -1;
>
> mm_pPropMan = GET_OPMPROPERTY_MANAGER(this->isA());
> if (mm_pPropMan != NULL)
> {
> mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> }
> //create only if not already done...
> if (0 != mm_ct) return mm_ct;
>
> //Create a custom dynamic property
> if SUCCEEDED( XLinieProperty::CreateInstance( &mm_newProp ))
> {
> mm_newProp->AddRef();
> //Fill up the attributes of the dynamic property (depends on your
> implementation of your dynprop)
> mm_newProp->SetCategory("Line-Props");
> mm_newProp->SetCategoryId( 0 );
> mm_newProp->SetCaption("Name");
> mm_newProp->setNumber(-1);
> mm_newProp->SetEditable(true);
> mm_newProp->setType(VT_BSTR);
> //add it to the propman
> _com_util::CheckError(mm_pPropMan->AddProperty( mm_newProp ));
> mm_ct++;
> }
> ...
> return mm_ct;
> }
>
> Steve Van Ausdall schrieb in im Newsbeitrag:
> 51994ABFC0E0D3976839D08732916C16@in.WebX.maYIadrTaRb...
> > Hi,
> >
> > I've been looking around for examples of using the IPropertyManager
> > to retrieve custom properties from entities, but can't seem to
> > find any. Can anyone help?
> >
> > Thanks,
> > Steve
> >
> >
> >
>
>
*Schlingheider, J.
Message 4 of 7 (225 Views)

Re:

01-01-2002 05:04 PM in reply to: *Van Ausdall, Steve
No, its's perfectly straight! mm_ct=0 means that there are none dynamic
props! But remember, not all props shown in the props dialog are dynamic
props. I suppose that those props shown are static properties, which come
from the COM-object wrapper. If you have a look at the typelib of your dbx,
and look out for the interface of the custom entity, then you'll probably
see the props (propput,propget) you see in your props dialog, Those
properties are managed by acopm directly. The way the values you enter are
assigned to the entity depend on the implemetation within the COM-coclass.
To change that won't be very easy, one way could be to create a new entity
which inherits from the existent one, but therefore you'd have to have the
header files. Another way would be to implement the com-interface in another
coclass, and try to make acopm use your coclass when accessing the entity
(by using the same GUID), but in that case you also have to know something
about the custom entity... so not an easy thing to do.
Regards, Joerg

> I'm actually trying to get properties from entities that someone else
wrote.
> The property I want does show up in the property panel. Is there some
other
> way to get values to appear there? Could you see if I'm doing something
> stupid? I have the following so far - but mm_ct is always set to 0.
>
> #include
> ...
> AcDbEntity *pEnt;
> AcDbObjectId oObjId;
> IPropertyManager *mm_pPropMan;
> ...
> acdbOpenObject(pEnt, oObjId, AcDb::kForRead);
> mm_pPropMan = GET_OPMPROPERTY_MANAGER(pEnt->isA());
> mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
>
> Thanks again,
> Steve
>
>
> "J. Schlingheider" wrote in message
> news:smileyvery-happy:5A247625F8C842C878B951F458479BD@in.WebX.maYIadrTaRb...
> > Hi Steve,
> > here's a sample for the creation of Properties with the help of
> > IPropertyManager. The property manager acts as a container for your
> dynamic
> > properties and handles them.
> > You can create your dynamic properties with the objarx wizard, which
> creates
> > a propertyadmin, which you don't need explicitly. What I did was to use
> the
> > wizard to get proper properties classes, delete the admin and handle the
> > dynprops within my custom objects like in the sample. I encountered a
> > problem of Acad by trying to use dynamic props for custom classes
> directly.
> > Here you have to use custom object COM wrappers otherwise acopm will get
> > confused and mixes up the properties of different classes.
> > Hope to help
> > Joerg
> >
> > Sample code:
> >
> > long CMyClass::setProps()
> > {
> > CComPtr mm_pPropMan;
> > XLinieProperty *mm_newProp = NULL; //My dynamic
property
> > long mm_ct = -1;
> >
> > mm_pPropMan = GET_OPMPROPERTY_MANAGER(this->isA());
> > if (mm_pPropMan != NULL)
> > {
> > mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> > }
> > //create only if not already done...
> > if (0 != mm_ct) return mm_ct;
> >
> > //Create a custom dynamic property
> > if SUCCEEDED( XLinieProperty::CreateInstance( &mm_newProp ))
> > {
> > mm_newProp->AddRef();
> > //Fill up the attributes of the dynamic property (depends on
your
> > implementation of your dynprop)
> > mm_newProp->SetCategory("Line-Props");
> > mm_newProp->SetCategoryId( 0 );
> > mm_newProp->SetCaption("Name");
> > mm_newProp->setNumber(-1);
> > mm_newProp->SetEditable(true);
> > mm_newProp->setType(VT_BSTR);
> > //add it to the propman
> > _com_util::CheckError(mm_pPropMan->AddProperty( mm_newProp ));
> > mm_ct++;
> > }
> > ...
> > return mm_ct;
> > }
> >
> > Steve Van Ausdall schrieb in im Newsbeitrag:
> > 51994ABFC0E0D3976839D08732916C16@in.WebX.maYIadrTaRb...
> > > Hi,
> > >
> > > I've been looking around for examples of using the IPropertyManager
> > > to retrieve custom properties from entities, but can't seem to
> > > find any. Can anyone help?
> > >
> > > Thanks,
> > > Steve
> > >
> > >
> > >
> >
> >
>
>
*Van Ausdall, Steve
Message 5 of 7 (225 Views)

Re:

01-02-2002 02:46 AM in reply to: *Van Ausdall, Steve
Happy New Year!

Thanks for your help on this - I really appreciate it.
I don't want to change anything or create new entities. All I want to do is
read the properties of objects that I don't have the source code for.
(Like the property window reads them) I don't even know if there is
a dbx... Is there an easy way to simply read them? Do you have code?
Would it involve QueryInterface? Is that an MFC thing?

Thanks again!
Steve

"J. Schlingheider" wrote in message
news:99E318FF853D44B376967FA11579F4E2@in.WebX.maYIadrTaRb...
> No, its's perfectly straight! mm_ct=0 means that there are none dynamic
> props! But remember, not all props shown in the props dialog are dynamic
> props. I suppose that those props shown are static properties, which come
> from the COM-object wrapper. If you have a look at the typelib of your
dbx,
> and look out for the interface of the custom entity, then you'll probably
> see the props (propput,propget) you see in your props dialog, Those
> properties are managed by acopm directly. The way the values you enter are
> assigned to the entity depend on the implemetation within the COM-coclass.
> To change that won't be very easy, one way could be to create a new entity
> which inherits from the existent one, but therefore you'd have to have the
> header files. Another way would be to implement the com-interface in
another
> coclass, and try to make acopm use your coclass when accessing the entity
> (by using the same GUID), but in that case you also have to know something
> about the custom entity... so not an easy thing to do.
> Regards, Joerg
>
> > I'm actually trying to get properties from entities that someone else
> wrote.
> > The property I want does show up in the property panel. Is there some
> other
> > way to get values to appear there? Could you see if I'm doing something
> > stupid? I have the following so far - but mm_ct is always set to 0.
> >
> > #include
> > ...
> > AcDbEntity *pEnt;
> > AcDbObjectId oObjId;
> > IPropertyManager *mm_pPropMan;
> > ...
> > acdbOpenObject(pEnt, oObjId, AcDb::kForRead);
> > mm_pPropMan = GET_OPMPROPERTY_MANAGER(pEnt->isA());
> > mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> >
> > Thanks again,
> > Steve
> >
> >
> > "J. Schlingheider" wrote in message
> > news:smileyvery-happy:5A247625F8C842C878B951F458479BD@in.WebX.maYIadrTaRb...
> > > Hi Steve,
> > > here's a sample for the creation of Properties with the help of
> > > IPropertyManager. The property manager acts as a container for your
> > dynamic
> > > properties and handles them.
> > > You can create your dynamic properties with the objarx wizard, which
> > creates
> > > a propertyadmin, which you don't need explicitly. What I did was to
use
> > the
> > > wizard to get proper properties classes, delete the admin and handle
the
> > > dynprops within my custom objects like in the sample. I encountered a
> > > problem of Acad by trying to use dynamic props for custom classes
> > directly.
> > > Here you have to use custom object COM wrappers otherwise acopm will
get
> > > confused and mixes up the properties of different classes.
> > > Hope to help
> > > Joerg
> > >
> > > Sample code:
> > >
> > > long CMyClass::setProps()
> > > {
> > > CComPtr mm_pPropMan;
> > > XLinieProperty *mm_newProp = NULL; //My dynamic
> property
> > > long mm_ct = -1;
> > >
> > > mm_pPropMan = GET_OPMPROPERTY_MANAGER(this->isA());
> > > if (mm_pPropMan != NULL)
> > > {
> > > mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> > > }
> > > //create only if not already done...
> > > if (0 != mm_ct) return mm_ct;
> > >
> > > //Create a custom dynamic property
> > > if SUCCEEDED( XLinieProperty::CreateInstance( &mm_newProp ))
> > > {
> > > mm_newProp->AddRef();
> > > //Fill up the attributes of the dynamic property (depends on
> your
> > > implementation of your dynprop)
> > > mm_newProp->SetCategory("Line-Props");
> > > mm_newProp->SetCategoryId( 0 );
> > > mm_newProp->SetCaption("Name");
> > > mm_newProp->setNumber(-1);
> > > mm_newProp->SetEditable(true);
> > > mm_newProp->setType(VT_BSTR);
> > > //add it to the propman
> > > _com_util::CheckError(mm_pPropMan->AddProperty( mm_newProp ));
> > > mm_ct++;
> > > }
> > > ...
> > > return mm_ct;
> > > }
> > >
> > > Steve Van Ausdall schrieb in im Newsbeitrag:
> > > 51994ABFC0E0D3976839D08732916C16@in.WebX.maYIadrTaRb...
> > > > Hi,
> > > >
> > > > I've been looking around for examples of using the IPropertyManager
> > > > to retrieve custom properties from entities, but can't seem to
> > > > find any. Can anyone help?
> > > >
> > > > Thanks,
> > > > Steve
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
*Schlingheider, J.
Message 6 of 7 (225 Views)

Re:

01-02-2002 07:00 PM in reply to: *Van Ausdall, Steve
Hi Steve,
happy new year to you as well!!
From which point do you want to read the properties? From a selected object,
when iterating through the database, from VB, ....? If you want to get
properties via the acopm mechanism you would have to use COM to achieve that. If
you have your object opened via the IAcadEntity-Interface, you have to use
QueryInterface in order to get the props of the custom object, you are quite
right here. Unfortunately I have no code for that problem ready at hand, but
someone else might have.
Regards,
Joerg

Steve Van Ausdall schrieb:

> Happy New Year!
>
> Thanks for your help on this - I really appreciate it.
> I don't want to change anything or create new entities. All I want to do is
> read the properties of objects that I don't have the source code for.
> (Like the property window reads them) I don't even know if there is
> a dbx... Is there an easy way to simply read them? Do you have code?
> Would it involve QueryInterface? Is that an MFC thing?
>
> Thanks again!
> Steve
>
> "J. Schlingheider" wrote in message
> news:99E318FF853D44B376967FA11579F4E2@in.WebX.maYIadrTaRb...
> > No, its's perfectly straight! mm_ct=0 means that there are none dynamic
> > props! But remember, not all props shown in the props dialog are dynamic
> > props. I suppose that those props shown are static properties, which come
> > from the COM-object wrapper. If you have a look at the typelib of your
> dbx,
> > and look out for the interface of the custom entity, then you'll probably
> > see the props (propput,propget) you see in your props dialog, Those
> > properties are managed by acopm directly. The way the values you enter are
> > assigned to the entity depend on the implemetation within the COM-coclass.
> > To change that won't be very easy, one way could be to create a new entity
> > which inherits from the existent one, but therefore you'd have to have the
> > header files. Another way would be to implement the com-interface in
> another
> > coclass, and try to make acopm use your coclass when accessing the entity
> > (by using the same GUID), but in that case you also have to know something
> > about the custom entity... so not an easy thing to do.
> > Regards, Joerg
> >
> > > I'm actually trying to get properties from entities that someone else
> > wrote.
> > > The property I want does show up in the property panel. Is there some
> > other
> > > way to get values to appear there? Could you see if I'm doing something
> > > stupid? I have the following so far - but mm_ct is always set to 0.
> > >
> > > #include
> > > ...
> > > AcDbEntity *pEnt;
> > > AcDbObjectId oObjId;
> > > IPropertyManager *mm_pPropMan;
> > > ...
> > > acdbOpenObject(pEnt, oObjId, AcDb::kForRead);
> > > mm_pPropMan = GET_OPMPROPERTY_MANAGER(pEnt->isA());
> > > mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> > >
> > > Thanks again,
> > > Steve
> > >
> > >
> > > "J. Schlingheider" wrote in message
> > > news:smileyvery-happy:5A247625F8C842C878B951F458479BD@in.WebX.maYIadrTaRb...
> > > > Hi Steve,
> > > > here's a sample for the creation of Properties with the help of
> > > > IPropertyManager. The property manager acts as a container for your
> > > dynamic
> > > > properties and handles them.
> > > > You can create your dynamic properties with the objarx wizard, which
> > > creates
> > > > a propertyadmin, which you don't need explicitly. What I did was to
> use
> > > the
> > > > wizard to get proper properties classes, delete the admin and handle
> the
> > > > dynprops within my custom objects like in the sample. I encountered a
> > > > problem of Acad by trying to use dynamic props for custom classes
> > > directly.
> > > > Here you have to use custom object COM wrappers otherwise acopm will
> get
> > > > confused and mixes up the properties of different classes.
> > > > Hope to help
> > > > Joerg
> > > >
> > > > Sample code:
> > > >
> > > > long CMyClass::setProps()
> > > > {
> > > > CComPtr mm_pPropMan;
> > > > XLinieProperty *mm_newProp = NULL; //My dynamic
> > property
> > > > long mm_ct = -1;
> > > >
> > > > mm_pPropMan = GET_OPMPROPERTY_MANAGER(this->isA());
> > > > if (mm_pPropMan != NULL)
> > > > {
> > > > mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> > > > }
> > > > //create only if not already done...
> > > > if (0 != mm_ct) return mm_ct;
> > > >
> > > > //Create a custom dynamic property
> > > > if SUCCEEDED( XLinieProperty::CreateInstance( &mm_newProp ))
> > > > {
> > > > mm_newProp->AddRef();
> > > > //Fill up the attributes of the dynamic property (depends on
> > your
> > > > implementation of your dynprop)
> > > > mm_newProp->SetCategory("Line-Props");
> > > > mm_newProp->SetCategoryId( 0 );
> > > > mm_newProp->SetCaption("Name");
> > > > mm_newProp->setNumber(-1);
> > > > mm_newProp->SetEditable(true);
> > > > mm_newProp->setType(VT_BSTR);
> > > > //add it to the propman
> > > > _com_util::CheckError(mm_pPropMan->AddProperty( mm_newProp ));
> > > > mm_ct++;
> > > > }
> > > > ...
> > > > return mm_ct;
> > > > }
> > > >
> > > > Steve Van Ausdall schrieb in im Newsbeitrag:
> > > > 51994ABFC0E0D3976839D08732916C16@in.WebX.maYIadrTaRb...
> > > > > Hi,
> > > > >
> > > > > I've been looking around for examples of using the IPropertyManager
> > > > > to retrieve custom properties from entities, but can't seem to
> > > > > find any. Can anyone help?
> > > > >
> > > > > Thanks,
> > > > > Steve
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
*Van Ausdall, Steve
Message 7 of 7 (225 Views)

Re:

01-04-2002 02:20 AM in reply to: *Van Ausdall, Steve
I want to read them while iterating through the database, in C++ (ARX) -
Thanks again for the help! - Steve

"J. Schlingheider" wrote in message
news:3C3439DC.FD2E61D8@web.de...
> Hi Steve,
> happy new year to you as well!!
> From which point do you want to read the properties? From a selected
object,
> when iterating through the database, from VB, ....? If you want to get
> properties via the acopm mechanism you would have to use COM to achieve
that. If
> you have your object opened via the IAcadEntity-Interface, you have to use
> QueryInterface in order to get the props of the custom object, you are
quite
> right here. Unfortunately I have no code for that problem ready at hand,
but
> someone else might have.
> Regards,
> Joerg
>
> Steve Van Ausdall schrieb:
>
> > Happy New Year!
> >
> > Thanks for your help on this - I really appreciate it.
> > I don't want to change anything or create new entities. All I want to do
is
> > read the properties of objects that I don't have the source code for.
> > (Like the property window reads them) I don't even know if there is
> > a dbx... Is there an easy way to simply read them? Do you have code?
> > Would it involve QueryInterface? Is that an MFC thing?
> >
> > Thanks again!
> > Steve
> >
> > "J. Schlingheider" wrote in message
> > news:99E318FF853D44B376967FA11579F4E2@in.WebX.maYIadrTaRb...
> > > No, its's perfectly straight! mm_ct=0 means that there are none
dynamic
> > > props! But remember, not all props shown in the props dialog are
dynamic
> > > props. I suppose that those props shown are static properties, which
come
> > > from the COM-object wrapper. If you have a look at the typelib of your
> > dbx,
> > > and look out for the interface of the custom entity, then you'll
probably
> > > see the props (propput,propget) you see in your props dialog, Those
> > > properties are managed by acopm directly. The way the values you enter
are
> > > assigned to the entity depend on the implemetation within the
COM-coclass.
> > > To change that won't be very easy, one way could be to create a new
entity
> > > which inherits from the existent one, but therefore you'd have to have
the
> > > header files. Another way would be to implement the com-interface in
> > another
> > > coclass, and try to make acopm use your coclass when accessing the
entity
> > > (by using the same GUID), but in that case you also have to know
something
> > > about the custom entity... so not an easy thing to do.
> > > Regards, Joerg
> > >
> > > > I'm actually trying to get properties from entities that someone
else
> > > wrote.
> > > > The property I want does show up in the property panel. Is there
some
> > > other
> > > > way to get values to appear there? Could you see if I'm doing
something
> > > > stupid? I have the following so far - but mm_ct is always set to 0.
> > > >
> > > > #include
> > > > ...
> > > > AcDbEntity *pEnt;
> > > > AcDbObjectId oObjId;
> > > > IPropertyManager *mm_pPropMan;
> > > > ...
> > > > acdbOpenObject(pEnt, oObjId, AcDb::kForRead);
> > > > mm_pPropMan = GET_OPMPROPERTY_MANAGER(pEnt->isA());
> > > > mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> > > >
> > > > Thanks again,
> > > > Steve
> > > >
> > > >
> > > > "J. Schlingheider" wrote in message
> > > > news:smileyvery-happy:5A247625F8C842C878B951F458479BD@in.WebX.maYIadrTaRb...
> > > > > Hi Steve,
> > > > > here's a sample for the creation of Properties with the help of
> > > > > IPropertyManager. The property manager acts as a container for
your
> > > > dynamic
> > > > > properties and handles them.
> > > > > You can create your dynamic properties with the objarx wizard,
which
> > > > creates
> > > > > a propertyadmin, which you don't need explicitly. What I did was
to
> > use
> > > > the
> > > > > wizard to get proper properties classes, delete the admin and
handle
> > the
> > > > > dynprops within my custom objects like in the sample. I
encountered a
> > > > > problem of Acad by trying to use dynamic props for custom classes
> > > > directly.
> > > > > Here you have to use custom object COM wrappers otherwise acopm
will
> > get
> > > > > confused and mixes up the properties of different classes.
> > > > > Hope to help
> > > > > Joerg
> > > > >
> > > > > Sample code:
> > > > >
> > > > > long CMyClass::setProps()
> > > > > {
> > > > > CComPtr mm_pPropMan;
> > > > > XLinieProperty *mm_newProp = NULL; //My dynamic
> > > property
> > > > > long mm_ct = -1;
> > > > >
> > > > > mm_pPropMan = GET_OPMPROPERTY_MANAGER(this->isA());
> > > > > if (mm_pPropMan != NULL)
> > > > > {
> > > > > mm_pPropMan->GetDynamicPropertyCount(&mm_ct);
> > > > > }
> > > > > //create only if not already done...
> > > > > if (0 != mm_ct) return mm_ct;
> > > > >
> > > > > //Create a custom dynamic property
> > > > > if SUCCEEDED( XLinieProperty::CreateInstance( &mm_newProp ))
> > > > > {
> > > > > mm_newProp->AddRef();
> > > > > //Fill up the attributes of the dynamic property (depends
on
> > > your
> > > > > implementation of your dynprop)
> > > > > mm_newProp->SetCategory("Line-Props");
> > > > > mm_newProp->SetCategoryId( 0 );
> > > > > mm_newProp->SetCaption("Name");
> > > > > mm_newProp->setNumber(-1);
> > > > > mm_newProp->SetEditable(true);
> > > > > mm_newProp->setType(VT_BSTR);
> > > > > //add it to the propman
> > > > > _com_util::CheckError(mm_pPropMan->AddProperty(
mm_newProp ));
> > > > > mm_ct++;
> > > > > }
> > > > > ...
> > > > > return mm_ct;
> > > > > }
> > > > >
> > > > > Steve Van Ausdall schrieb in im
Newsbeitrag:
> > > > > 51994ABFC0E0D3976839D08732916C16@in.WebX.maYIadrTaRb...
> > > > > > Hi,
> > > > > >
> > > > > > I've been looking around for examples of using the
IPropertyManager
> > > > > > to retrieve custom properties from entities, but can't seem to
> > > > > > find any. Can anyone help?
> > > > > >
> > > > > > Thanks,
> > > > > > Steve
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
>
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.