Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing External File References! 2

Status
Not open for further replies.

Agridion

Mechanical
Jan 30, 2007
5
0
0
US
I was wondering if anyone knows of a way to write to SolidWorks external file references. I know there is a way to ListExternalFileReferences2 but I have not found a way to actaully write to them. I am trying to mimic the File, Save As, References..., Edit Referenced File Locations. I want to be able to write a program to automatically save files that are incontext anyway I want.

Thanks.
 
Replies continue below

Recommended for you

SldWorks.ReplaceReferencedDocument is probably the closest thing to what you want to do - this will update the references (and you don't have to actually have the file open). Note that when you next open the assembly, you will be prompted that there is an internal ID difference with the new file...
 
Ok guys I have tried the ListExternalFileReferences and that is great But I can't write to them to change The references.

I have also tried ReplaceReferencedDocument and that doesnt change the ModelPathname (refereing to the example Get External References).

SolidAir you mentioned in another thread about having documentation on SolidWorks Document Manager API's? Is there any way I can get it.

I also know that 2007 is going to offer the Document manager API in the standard API file but right now I am trying to figure a way to do this in 2006. Any help?
 
For 2006 you will have to email SolidWorks API support for a license key string to use Document Manager API. You will be given a key, but the key cannot be distributed outside your company in an uncompiled macro.
 
I installed SW 2007 and looked though their API which includes the commands from the SWDoucmentMgr. I still can't figure out how to copy an assembly with parts that are in-context and rename everything to a different name but still all of the parts be in-context.

The Command swApp.CopyDocument in their "Copy Document and Its Dependencies Example" will copy an assembly and its in-context parts but if you rename the assembly all of the parts will be out-of-context. The swApp.CopyDocument will allow you to rename the parts but not the assembly.

Maybe it would help if I described the assembly I am trying to copy and rename. I built a part say a cylinder and inserted it into an assembly. Then in that assembly I Insert, Component, New part and choose the right plane. Then exited the sketch that it automatically creates. Then I copied a surface (offset surface 0) thickened it and then turned it into a sheet metal part. I will create several more parts for all of the surfaces of the cylinder. The first part that is a cylinder is the driving part of my assembly. Which is why when I copy an assembly over I want all the parts to be in-context so I can change the dimensions of the cylinder and all the sheet metal parts will update.

Any help on how I can accomplish this?
 
Status
Not open for further replies.
Back
Top