Options
Options
(OP)
How do I change the options I get with someone else's part or assembly or drawing too for that matter, to the options I have set for myself? I know there must be a way to do this, but I can't seem to find it. Thanks.
When was the last time you drove down the highway without seeing a commercial truck hauling goods?
Download nowINTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
|
RE: Options
Jeff Mowry
DesignHaus Industrial Design
http://www.designhaus-i-d.com
RE: Options
MadMango
"Probable impossibilities are to be preferred to improbable possibilities."
Have you read FAQ731-376 to make the best use of Eng-Tips Forums?
RE: Options
RE: Options
If you have any experience with VB...
Go to Help (in SW) and click: "SolidWorks API Help Topics"
look up:
ModelDoc2::GetUserPreferenceToggle
ModelDoc2::SetUserPreferenceToggle
ModelDoc2::GetUserPreferenceDoubleValue
ModelDoc2::SetUserPreferenceDoubleValue
ModelDoc2::GetUserPreferenceIntegerValue
ModelDoc2::SetUserPreferenceIntegerValue
ModelDoc2::GetUserPreferenceStringValue
ModelDoc2::SetUserPreferenceStringValue
ModelDoc2::GetUserPreferenceTextFormat
ModelDoc2::SetUserPreferenceTextFormat
Basically what you want to do is Open 2 documents...
Get a property from one document and Set it to the other document.
You can start the program off by recording a macro...
Click: Tools>Macro>Record
...Open 2 documents, then close them...
Stop the macro, and Save it to your hard drive...
Then Click: Tools>Macro>Edit...
And select the file you just saved...
your macro should look similar to this:
Dim swApp As Object
Dim Part As Object
Dim boolstatus As Boolean
Dim longstatus As Long
Dim Annotation As Object
Dim Gtol As Object
Dim DatumTag As Object
Dim FeatureData As Object
Dim Feature As Object
Dim Component As Object
Sub main()
Set swApp = CreateObject("SldWorks.Application")
Set Part = swApp.OpenDoc4("C:\File1.SLDPRT", 1, 0, "", longstatus)
Set Part = swApp.ActivateDoc("_01 test grid.SLDPRT")
swApp.ActiveDoc.ActiveView.FrameLeft = 0
swApp.ActiveDoc.ActiveView.FrameTop = 0
swApp.ActiveDoc.ActiveView.FrameState = 1
swApp.ActiveDoc.ActiveView.FrameState = 1
swApp.ActiveDoc.ActiveView.FrameState = 1
swApp.LoadFile2 "C:\File2.SLDPRT", ""
Set Part = swApp.ActiveDoc
Set Part = swApp.OpenDoc4("C:\File2.SLDPRT", 1, 0, "", longstatus)
swApp.ActiveDoc.ActiveView.FrameLeft = 0
swApp.ActiveDoc.ActiveView.FrameTop = 0
swApp.ActiveDoc.ActiveView.FrameState = 1
Set Part = swApp.ActivateDoc("File2.SLDPRT")
Set Part = Nothing
swApp.CloseDoc "File2.SLDPRT"
swApp.ActiveDoc.ActiveView.FrameLeft = 0
swApp.ActiveDoc.ActiveView.FrameTop = 0
swApp.ActiveDoc.ActiveView.FrameState = 1
Set Part = swApp.ActivateDoc("File1.SLDPRT")
Set Part = Nothing
swApp.CloseDoc "_01 test grid.SLDPRT"
End Sub
Now what you want to do is make it to where each part is assigned to a seperate object...
Change:
Dim Part As Object
...To...
Dim Part As Object, Part2 As Object
Set Part = swApp.OpenDoc4("C:\File2.SLDPRT", 1, 0, "", longstatus)
...To...
Set Part2 = swApp.OpenDoc4("C:\File2.SLDPRT", 1, 0, "", longstatus)
Set Part = swApp.ActivateDoc("File2.SLDPRT")
Set Part = Nothing
...To...
Set Part2 = swApp.ActivateDoc("File2.SLDPRT")
Set Part2 = Nothing
Then you can place your preference commands between...
swApp.ActiveDoc.ActiveView.FrameState = 1
Set Part = swApp.ActivateDoc("File1.SLDPRT")
...and...
Set Part = Nothing
swApp.CloseDoc "_01 test grid.SLDPRT"
If this is too confusing, just post your questions here...
Thanks,
--Josh--
RE: Options
What you will get is an excel file which can import and export document options for SolidWorks files. Run the import routine with your desired template files and then you can write out all of the options to the active SolidWorks document.
RE: Options