×
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

PDF Journal VB Script Problems

PDF Journal VB Script Problems

PDF Journal VB Script Problems

(OP)
Hello,

I'm having an issue in modifying the export PDF journal a buddy of mine found on here, and I'm running into some issues. What I'm trying to do is add a save function into it, so that after it updates the views and exports the PDF, it saves the assembly.

I attached the file.

Basically, it does what I want it to already, but I don't want to have to use SendKeys to save. Does anyone here know how to save directly? What is the function?

Any help would be greatly appreciated!


RE: PDF Journal VB Script Problems

The journal recorder is a great tool to generate some code to work with. The output of the journal recorder for a save operation looks like:

CODE

Dim partSaveStatus1 As PartSaveStatus
partSaveStatus1 = workPart.Save(BasePart.SaveComponents.True, BasePart.CloseAfterSave.False)
partSaveStatus1.Dispose()

These lines of code will save the work part along with any components that you have write access to, and it will leave the file open after the save operation. You can change these options by modifying the True/False values as necessary.

www.nxjournaling.com

RE: PDF Journal VB Script Problems

(OP)
Thank you sir! I actually did try that, but it wasn't seeming to work. I'm not exactly a pro on VBA, so that is probably why.

Thanks for your help!

RE: PDF Journal VB Script Problems

(OP)
Ok, I have done another rev on the file, and would like to add a Checkmate function directly into the journal. I recorded a journal while Checkmating, copied it to the PDF Export Journal, and replaced my save function with the Checkmate function. However, in line 135 it defines the file that it checkmates, under validators1. Can I not just replace the path that is there, and replace it with "currentFile"? It is already defined elsewhere in the journal.

The problem is, it's not working. What am I doing wrong?

Any help would be awesome!!

RE: PDF Journal VB Script Problems

What did the recorded journal code look like before you modified it?

www.nxjournaling.com

RE: PDF Journal VB Script Problems

Rather than using currentFile, use workPart.FullPath.

www.nxjournaling.com

RE: PDF Journal VB Script Problems

(OP)
I replaced currentFile with workPart.FullPath and it still doesn't seem to be working. It does the same as before - flashes "Checking Complete" on the info bar, but doesn't actually checkmate.

CODE --> VBA

' NX 7.5.4.4
' Journal created by kevin.wegner on Thu Jun 28 08:47:01 2012 Eastern Daylight Time
'
Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim displayPart As Part = theSession.Parts.Display

Dim validators1() As Validate.Validator
theSession.ValidationManager.FindValidator("Check-Mate", validators1)

validators1(0).ClearPartNodes()

Dim validators2() As Validate.Validator
theSession.ValidationManager.FindValidator("Check-Mate", validators2)

        validators1(0).AppendPartNode("workPart.FullPath.")

Dim validators3() As Validate.Validator
theSession.ValidationManager.FindValidator("Check-Mate", validators3)

Dim validatorOptions1 As Validate.ValidatorOptions
validatorOptions1 = validators1(0).ValidatorOptions

Dim validators4() As Validate.Validator
theSession.ValidationManager.FindValidator("Check-Mate", validators4)

Dim status1 As Validation.Result
status1 = validators1(0).Commit()

Dim parsers1() As Validate.Parser
theSession.ValidationManager.FindParser("Validation Gadget", parsers1)

parsers1(0).ClearResultObjects()

parsers1(0).DataSource = Validate.Parser.DataSourceTypes.MostRecentRun

parsers1(0).MaxDisplayObjects = 25

Dim parsers2() As Validate.Parser
theSession.ValidationManager.FindParser("Validation Gadget", parsers2)

parsers1(0).Commit()


End Sub
End Module 

RE: PDF Journal VB Script Problems

(OP)
And the "." after workPart.FullPath was a typo - it didn't make a difference regardless.

RE: PDF Journal VB Script Problems

No quotes.

CODE

validators1(0).AppendPartNode(workPart.FullPath) 

www.nxjournaling.com

RE: PDF Journal VB Script Problems

(OP)
I tried that, and on MS Visual Studio it no longer highlights workPart.FullPath. I run it, and it does the same thing. It doesn't checkmate.

RE: PDF Journal VB Script Problems

You'll have to look at the status1 variable to see the results.

www.nxjournaling.com

RE: PDF Journal VB Script Problems

Were you able to get the information you needed?

www.nxjournaling.com

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