×
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

NX9 - Orient to Isometric and export Jpeg

NX9 - Orient to Isometric and export Jpeg

NX9 - Orient to Isometric and export Jpeg

(OP)
I am trying to create a journal to orient the model view to ISOMETRIC, then to export a Jpeg to a specific directory.

Journal does not seem to record exporting a Jpeg. I found the attached file is a code I found that almost does what I want. I had to turn off the GetUnloadOption lines to get it to work but it creates a jpg for every view. I would only want the ISOMETRIC view. I cannot figure out how to change that.


1) Will someone please help me adjust it to my needs?

2) The lines I turned off... are they important to have for any reason that I would want to fix them rather than turn them off?

PS
My original plan was to create code that would switch to modeling (if not in modeling already), orient to an iso view, shade it (crap, I dont think I have this code set to shade it), export a jpeg, switch to drafting and import the image it created and place it on the sheet. As soon as I realized that I couldnt find anything on changing applications, I gave up on that idea and decided to work toward two different buttons for this.

RE: NX9 - Orient to Isometric and export Jpeg

Hello Kenja824,

The following should process only the Isometric view.

Hope this helps,
Joe

    For Each wpModelingView In workPart.ModelingViews  
        If wpModelingView.Name = "Isometric"
            workPart.Views.WorkView.Orient(wpModelingView.Name, View.ScaleAdjustment.Fit)  
            strPartJpg = partName & "_" & wpModelingView.Name & ".jpg"  
            strPartJpg = Path.Combine(outputDirectory, strPartJpg)  
            ufs.Disp.CreateImage(strPartJpg, UFDisp.ImageFormat.Jpeg, UFDisp.BackgroundColor.White)  
        End If
    Next 

RE: NX9 - Orient to Isometric and export Jpeg

(OP)
Thanks Jpetach

However, I get an error when I run this.

NXOpen.NXException: The view may not be rotated
at NXOpen.View.Orient(String viewName, ScaleAdjustment viewScale)
at Module.Main() in C:\Users\Kschonmeier\AppData\Local\Temp\NXJournals2616\journal.vb:line 40


Line"40 is....
workPart.Views.WorkView.Orient(wpModelingView.Name, View.ScaleAdjustment.Fit)


RE: NX9 - Orient to Isometric and export Jpeg

Hello Kenja824,

My suspicion is that error is part specific. Does this occur for a newly created part (ideally using file-> New -> Blank)?
The system defined "Isometric" view should not have any rotation and the line mentioned is not attempting to rotate the view orientation.

-joe

RE: NX9 - Orient to Isometric and export Jpeg

(OP)
Ha! I see what was wrong. It was me that was wrong. My overall plan is to have the code export a jpeg as this code does, but then go to drafting and insert the image. So not thinking clearly, I tried running this code from drafting. If I go to modeling, it works perfectly.

However, I am having a hard time trying to get code switch over to drafting and insert the image now. I have never figured out how to switch from modeling to drafting in VB code and not even sure if it can be done. I tried to record a journal from the drafting side that just turns the display sheet off (so it looks like you are in modeling) but it seems to not record that either. Starting to think I need to just make this into two different buttons.

Thanks for the help Jpetach.

RE: NX9 - Orient to Isometric and export Jpeg

Hello Kenja824,

NX journals have access to modeling and drafting functions without needing to switch applications. However, the journal code has to insure that the NX session is displaying the contents that would be displayed in the respective applications. So, for the purpose of exporting the jpeg image the drawing sheet is not the proper display. Switching to a layout that contains a model view is needed.

Please see the discussion http://www.eng-tips.com/viewthread.cfm?qid=264567 and look at the April 18th discussion about switching to the "L1" layout. In the example code the "Top" view was being used, where your case would use Isometric.

HTH,

Joe

RE: NX9 - Orient to Isometric and export Jpeg

Why would you want to add an isometric view in JPeg? NX9 can add a shaded Isometric view directly.
Just curious why you are choosing this path. :)

Ronald van den Broek
Senior Application Engineer
Winterthur Gas & Diesel Ltd
NX9 / TC10.1.2

Building new PLM environment from Scratch using NX11 / TC11

RE: NX9 - Orient to Isometric and export Jpeg

Quote (NutAce)

Why would you want to add an isometric view in JPeg? NX9 can add a shaded Isometric view directly.
Just curious why you are choosing this path. :)

I can't speak for Kenja824, but I can say that I've experienced lots of frustration with trying to plot drawings with shaded views. In some cases we've resorted to creating a jpg and importing that to the drawing. We've opened various IR's with GTAC, but the situation remains the same.

www.nxjournaling.com

RE: NX9 - Orient to Isometric and export Jpeg

Kenja824,
There is a command in the API to switch applications (e.g. modeling to drafting), in NX 9 this is the .ApplicationSwitchRequest method. The downside here is the switch doesn't happen until the rest of your code finishes executing. Using this method won't provide the result you are looking for. NX 10 and above has the .ApplicationSwitchImmediate method which attempts to switch as soon as the method is called.

To get what you want in NX 9, you could start in the drafting module, turn the sheet display off (.AskDisplayState, .SetDisplayState), orient the view, generate the image, turn the sheet display on, and import the image (.CreateImageFromFile).

www.nxjournaling.com

RE: NX9 - Orient to Isometric and export Jpeg

(OP)
Thank you

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