how to "Edit" part in assembly by API

Hi,

This is prasad, present i am working on SolidEdge API and i using Visual C++,i have  stucked with "Edit" the part or assembly in the assembly or in sub assembly.

please help me to how to edit the part or assembly in the model tree .

after editing the part i want to save the part..

by interactively i doing all the save operations in SE,but throgh API i did n't find any such edit methods ..

 

please reply to me

 

thanks

Prasad

 

Posted by: prasad k
Post date: 10/31/2011 12:28:09 AM

7 REPLIES

RE: how to "Edit" part in assembly by API

Hi Prasad,

 

according to my understanding of your question you need to get the Occurrence object of the assembly component you want to edit. Via Occurrence.OccurrenceDocument or Occurrence.OccurrenceFilename you could get access to the document. Now you may edit and save the document. If my answer doesn't help you, please precise a little bit more what you want to do and where you get currently stucked.

 

 

Posted by: Wolfgang Kunert
Post date: 11/9/2011 8:22:46 PM

RE: how to "Edit" part in assembly by API

 

Hi Wolfgang Kunert,

My model document is like this

 

TopAssmebly

   |                                                    |-part1

   |                          |-subassembly-|-part2

Inner-1Assembly-|-part3

    |                        |-part4

    |                                                    |-part5

Inner-2Assembly-|-subassemby1-|-part6

   |                         |-part7

   |

part8

 

 

Interactively we can "edit" the part or subassembly  from the context menu assemblypathfinder.I am trying to set the same status through COM API for this tasks.

 

1.I want to save the occurrence(parts/sub assembly) in the innerlevels after setting some propeties to that occurrence. Presently I am opening that occurrence document , saving and closing it,with this the performance is not good.

If i am calling save on that occurrence document with out opening it,solidedge is raising message like this "Can not save the file. You may not have write-access for the file or directory. " 

 

Example: for the above model document when call the save on "TopAssembly" ,it's working fine.for the inner and subassembly,parts we doing open and save,then after close

 

 

2. I want to insert the new occurrence(part/assembly) in the inner levels,first I am getting the in which assembly we want to insert the new occurrence,by using "AddByFileName" API method I inserting the occurrence it's working fine for top level only.

 

Example: for the above model document i am inserting the new document in the topassembly is fine for the inner and subassemblies we are opening the document and inserting,save and close.

 

3.Like for the "repalce"  also , we are facing the same issue.

 

Example :we want to replace the "part7" with the new document ,if i do direc on the top level document it's crashing,by openig that toplevel document and do save,close,it's fine..

 

for the above 3 tasks we need to do "EDIT" that occurrence document for improving the performance.

 

Is there any alternate options to do this tasks,please reply to me.

 

Regards

Prasad  

 

Posted by: prasad k
Post date: 11/11/2011 12:43:02 AM

RE: how to "Edit" part in assembly by API

Hi Prasad,

 

for your issue 1) above the method Occurrence.MakeWritable should help. For all other issues dealing with modifying the assembly structure i recommend to use the RevisionManager object instead of Solid Edge to accomplish tasks like inserting or replacing components. Via the LinkedDocuments collection you may still open individual documents with Solid Edge if required.

 

Posted by: Wolfgang Kunert
Post date: 11/11/2011 1:35:31 AM

RE: how to "Edit" part in assembly by API

Hi Wolfgang Kunert,Thanks for  your reply, with your suggestions we resolve the issues.

can you please give some ideas for this problem   " for my above example model i need traverse from Part1 to Subassm and  do some actions on subassembly ,and   then got to subassmembly to Inner-1assembly and do some actions.And then go to Inner-1assembly to Topassembly and do some actions"  

 

for this problem initially i selected the  Part1 by interactively,then i getting that occurrence object  referred to part1  through  selectionset, through that occurrence i getting the topleveldocument, it returns subaasembly document.after doing some actions on that document.i need to get the Inner-1assembly document object. 

in that level no method  like topleveldocument in the solidedgedocument or in the assemblydocument.

please reply to me how to i get the inner-1assembly document ?

RegardsPrasad

 

 

Posted by: prasad k
Post date: 11/15/2011 3:14:28 AM

RE: how to "Edit" part in assembly by API

Hi Prasad,

 

i didn't try myself, but the property Parent of an AssemblyDocument may lead you to the parent assembly document if it is not already the top level assembly document. Because then you will get the Solid Edge Application object.

 

Posted by: Wolfgang Kunert
Post date: 11/15/2011 4:55:20 AM

RE: how to "Edit" part in assembly by API

Hi Wolfgang Kunert ,

Any idea for my above issue,please give some clue or solution for that.

thanksPrasad

 

Posted by: prasad k
Post date: 11/16/2011 11:17:04 PM

RE: how to "Edit" part in assembly by API

Hi,

I need some more information on SE for my problem.when i want to Edit the part/subassembly in the above model,then it becomes the active document ,after doing some changes on that document.Then i need to go to Parent of that edited document and do some changes,again i want to go to parent of taht one upto toplevel model.

 

give some idea for this problem.

 

Thanks

Prasad

 

Posted by: prasad k
Post date: 12/8/2011 10:47:01 PM