Get "custom" properties

Hi all solid edge programmers

I'm working on a project and I need to read all the "custom" properties in a solid edge project, basically for each part, each part in assembly, each part in draft, for each possible project in solid edge. I need to transfer these data into database, i can handle that, the problem is to get them from solid edge file... can u please help me to get the custom properties for example for each part in a assembly?

 

PS: working in c++, VS.NET2003

 

Thanks

 

Posted by: Marian Petrik
Post date: 1/13/2007 2:21:33 AM

10 REPLIES

RE: Get "custom" properties

Hi Marian,

 

I can most certainly help you. Since you're using C++, I would suggest completely bypassing the Solid Edge API and using Microsoft's Structured Storage API. It will be much easier and faster. I'll put together an example for you in the next day or so and post it as a reply.

 

Posted by: Jason Newell
Post date: 1/14/2007 12:16:40 PM

RE: Get "custom" properties

Hi Jason,

The problem is i have to use the Solid Edge API and i have to use c++, because i'm just adding a feature to existing project. Basically i have an idea how to get the properties but i don't understand how to go through the whole project, i mean through all parts in assembly for example... i need to read a custom properties for each part.

 

In attachment is a code for reading custom properties from one part, and i need to do the same for the whole project...

if u have an idea... thanks

 

Posted by: Marian Petrik
Post date: 1/14/2007 8:52:14 PM

RE: Get "custom" properties

Marian,

 

See if this example helps.

 

 

 

Posted by: Jason Newell
Post date: 1/16/2007 7:34:47 AM

RE: Get "custom" properties

Hi Jason

I used your code and it work's very well, exactly what i need, i'm gonna have a look at the Microsoft Structured Storage api and i should be allright thanks very much.

 

Posted by: Marian Petrik
Post date: 1/17/2007 4:17:32 AM

RE: Get "custom" properties

Marian,

 

That's great! I've only been programming C++ for about a year but I'm really excited about how powerful it is. It's nice to be able to help other C++ programmers. I'm finally to a point with C++ that I can do just about anything I want and that's very nice. Take care.

 

Posted by: Jason Newell
Post date: 1/17/2007 4:20:51 AM

RE: Get "custom" properties

Jason,

 

there is one little bug in the program.

If you run it on an assembly which has an InterPartCopy in a sub-part linked to a part document on a higher level, the recursion may result in an infinite loop.

If I change the code to follow only the Normal links, it will be okay.

 

Martin

 

Posted by: Martin Bernhard
Post date: 1/18/2007 8:37:40 PM

RE: Get "custom" properties

Martin,

 

Thanks for pointing that out to everyone. I have run across the recurisve link issue several years ago and simply forgot about it when I wrote this example.

 

Posted by: Jason Newell
Post date: 1/19/2007 5:04:41 AM

RE: Get "custom" properties

 

Jason,

Can you please post the example again.

Why have you suggested not to use SolidEdge APIs for handling File Properties.

I want to populate some custom properties in a Draft Document .

Regards,

Kalpesh

 

Posted by: KALPESH PARMAR
Post date: 1/30/2008 11:19:33 AM

RE: Get "custom" properties

 

Kalpesh,

 

I'm sorry but during my last site upgrade, I lost a lot of attachments. I did find this article with some good code. Give it a try and let me know how it goes.

 

http://support.microsoft.com/kb/q186898/

The only thing that I'd change about the article is that I'd use "Smart Pointers".  i.e.//IStorage *pStorage = NULL;//IPropertySetStorage *pPropSetStg = NULL;/* Use Smart Pointers instead */IStoragePtr pStorage = NULL;IPropertySetStoragePtr pPropSetStg = NULL;// Open the document as an OLE compound document.hr = :Smiley FrustratedtgOpenStorage(wcFilename, NULL,STGM_READ | STGM_SHARE_EXCLUSIVE, NULL, 0, &pStorage);pPropSetStg = pStorage; /* QueryInterface built in */...pPropSetStg = NULL; /* Release() is called for you */pStorage = NULL; /* Release() is called for you */

 

 

Calum, you got any examples that you could share?

 

Posted by: Jason Newell
Post date: 1/30/2008 6:03:03 PM