×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Writing External File References!
2

Writing External File References!

Writing External File References!

(OP)
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.

RE: Writing External File References!

Agridion,

Look in API help for ModelDocExtension::ListExternalFileReferences

SA

RE: Writing External File References!

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...

RE: Writing External File References!

...assuming that the new file isn't just a renamed, relocated copy of the original. smile

RE: Writing External File References!

(OP)
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?

RE: Writing External File References!

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.

RE: Writing External File References!

(OP)
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?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources