×
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

saving to parasolid

saving to parasolid

saving to parasolid

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

RE: saving to parasolid

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

RE: saving to parasolid

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

RE: saving to parasolid

I don't know if it matters, but your extension of "X_T" was capitalized in your last post.

Jeff Mowry
www.industrialdesignhaus.com
Reason trumps all.  And awe trumps reason.

RE: saving to parasolid

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

RE: saving to parasolid

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

RE: saving to parasolid

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

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