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!

saving to parasolid

Status
Not open for further replies.

roboeng

Bioengineer
Nov 27, 2001
7
0
0
US
I am trying to write a macro that will take the current solid part I am working with export it to a file with a new name based on the original name, a custom revision field, and a Custom description. I have the code able to compile the filename and path as I want but cannot get it to export the file. The statement I am using is from the help example:

bRet = swPart.SaveAs4(sPathName, _
swSaveAsCurrentVersion, _
swSaveAsOptions_Silent, _
nErrors, _
nWarnings)


the pathname I am entering is, for example:

C:\RD-1020 Rev X4 HOUSING-TRANSMISSION.x_t

When I run the file it does nothing. If I change the extension to .sldprt or .tif then it will save the file. I am using sw 2004 sp 2.1 and no I cannot upgrade. The documentation states that if you put the extension in this command should automatically do the conversion to the extension, but when I put in either .x_t or .igs nothing happens. Can someone help me figure this out.

I checked out faq559-530 but did not see anything that helped solve my problem.

 
Replies continue below

Recommended for you

Get rid of the spaces in your filename.
Try a shorter filename.

Importing Parasolid files into UG would fail if there was a space in the filename or directory path.


"Wildfires are dangerous, hard to control, and economically catastrophic."

Ben Loosli
Sr IS Technologist
L-3 Communications
 
I changed the file name to "c:\test.X_T" and it still will not work. I was able to get the igs extension to work today, I must of had a typo that I corrected today. The parasolid export will still not work.
 
I've tried it both ways capital and lower I even tried to export the binary version using x_b but it is like the saveas4 command does not recognize the parasolid extension.
 
Probably won't make any difference but, have you tried the full "xmt_txt" and "xmt_bin" extensions?

[cheers]
Helpful SW websites FAQ559-520
How to get answers to your SW questions FAQ559-1091
 
That helped a lot actually. When I use the full extension it will now save a file to the directory, which is at least progress. Now the problem is that the file is unusable. Even solidworks will not open the file it just saved out. I tried making sure that the parasolid version is set correctly. The software I am converting this for needs v 12. As you can see in the code below I try and change it in two places. The change works in for the first change but not for the second. I have tried performing the changes seperately and together and the file is still unusable.

Sub main()
Dim swApp As SldWorks.SldWorks
Dim swPart As SldWorks.ModelDoc2
Dim sPathName As String
Dim nRetVal As Long
Dim nErrors As Long
Dim nWarnings As Long
Dim bRet As Boolean

Set swApp = Application.SldWorks
Set swPart = swApp.ActiveDoc

bRet = swApp.SetUserPreferenceIntegerValue(swParasolidOutputVersion, 7)

If bRet = False Then
Debug.Print "swApp Parasolid Version : " + Str(swApp.GetUserPreferenceIntegerValue(swParasolidOutputVersion))
nRetVal = swApp.SendMsgToUser2("sw App Did not Set output Version", swMbWarning, swMbOk)
End If

bRet = swPart.SetUserPreferenceIntegerValue(swParasolidOutputVersion, 7)
If bRet = False Then
Debug.Print "swPart Parasolid Version : " + Str(swPart.GetUserPreferenceIntegerValue(swParasolidOutputVersion))
nRetVal = swApp.SendMsgToUser2("Did not Set output Version", swMbWarning, swMbOk)
End If
sPathName = "c:\test.xmt_txt"
bRet = swPart.SaveAs4(sPathName, _
swSaveAsCurrentVersion, _
swSaveAsOptions_Silent, _
nErrors, _
nWarnings)
If bRet = False Then
nRetVal = swApp.SendMsgToUser2("Problems Saving File.", swMbWarning, swMbOk)

End If


Debug.Print sPathName
End Sub
 
Status
Not open for further replies.
Back
Top