Cancel
Showing results for 
Search instead for 
Did you mean: 

Changing to moddeling task from Drafting

Pioneer
Pioneer

Hi,

 

I need to switch to Moddeler application to make another part the work part;

 

Dim sValue As Snap.NX.Part = proto

Snap.Globals.WorkPart = proto

 

How to switch applcations ? SNAP reference guide delivers nothing I could think of as search string. 

Thanks in advance.

 

 

8 REPLIES

Re: Changing to moddeling task from Drafting

Esteemed Contributor
Esteemed Contributor

In general, you don't need to switch applications to use the modeling API.

 

In the NXOpen API there is the NXOpen.MenuBar.MenuBarManager.ApplicationSwitchRequest() method to switch the NX application after the custom dialog is closed.

May be that could help.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX12.0

How to Get the Most from Your Signature in the Community

Re: Changing to moddeling task from Drafting

Pioneer
Pioneer

I actually have to change to moddeling as this is what the error said...

 

I was trying to get the leaf of the drawing so I can get the part name from it. Then it said I am not in moddeling when I returned the error message. So It needs to be done. Only thing is the commands you give me does not exist in SNAP either. It is an NXopen method.

 

So I come to the conclusion SNAP is still in its nappy stage and it is not useful. I think journalling has more possibilities however saying that I have yet to try and do that in a journal file.

 Do you mind showing me an example as I might be able to do this in journalling then.

For this "NXOpen.MenuBar.MenuBarManager.ApplicationSwitchRequest()"

 

But thanks for your time.

Re: Changing to moddeling task from Drafting

Esteemed Contributor
Esteemed Contributor

I have had no need to switch applications by now, so I don't have an example.

 

Have you searched the forum, archived BBS or the solution center for it?

Use only the method name and not the full namespace for the search string.

 

BTW, SNAP is still at its beginning, being introduced in NX8, so there is more to come.

 

Journal support is not covering entire NX yet too, but it is getting better with each new release of NX.

You will have to do some manual research and coding in any case.

 

You know development is 90% research and only 10% writing code.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX12.0

How to Get the Most from Your Signature in the Community

Re: Changing to moddeling task from Drafting

Siemens Phenom Siemens Phenom
Siemens Phenom

 

We have never had a command in the programming toolkits that would let you switch between Modeling and Drafting while the program was running, and this is still true through NX 9.

 

However you can usually accomplish what you need by setting the drawing display state to on or off, depending on whether you want it look like Modeling or Drafting.

 

So if you have a drawing displayed, and you want to turn off the display of the drawing, you can use a wrapper method like this:

 

     theUfSession.Draw.SetDisplayState(1)

 

If you want the drawing sheet to be displayed, pass a 2 instead of a 1.  (That will only work when there is a current drawing.)

 

Also I believe the current plan for NX10 includes an NXOpen method that will allow switching applications while the program is running.  This has been a popular enhancement request.

 

 

 

Re: Changing to moddeling task from Drafting

Pioneer
Pioneer

Hi,

 

Thanks for the reply. The task is to export a STEP file from the same program that exports DXF file from the drafting task. I was wondering now, is is possible to run a journal from SNAP. This will enable me to switch tasks in the journal and then carry on in the SNAP program.

 

Thanks,

 

 

Re: Changing to moddeling task from Drafting

Honored Contributor
Honored Contributor
I'm fairly certain that you will be able to export the DXF and STEP files without needing to switch applications within NX. This can all be done in a single journal.

Re: Changing to moddeling task from Drafting

Esteemed Contributor
Esteemed Contributor
  1. What are you trying to do?
  2. Is there user interaction needed?
  3. Why is there user interaction needed?
  4. You have access to all objects in the part file from NXOpen API, so everything can be done in Gateway.
Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX12.0

How to Get the Most from Your Signature in the Community

Re: Changing to moddeling task from Drafting

Siemens Phenom Siemens Phenom
Siemens Phenom

> is it possible to run a journal from SNAP. This will enable me to switch tasks

> in the journal and then carry on in the SNAP program.

 

You are just writing Visual basic programs. And, in any Visual Basic program, you can call functions from any library you like. So specifically, your program can call functions in the SNAP library, or functions in the the NX/Open library, or System.Windows functions, or thousands of others. You can mix and match at will.

 

So, if there are no SNAP functions to do the things you want, then just call NX/Open functions, instead. The two libraries are designed to work together. But, in cases where there *is* a SNAP function, it will probably be easier to call than the NX/Open one, so call the SNAP one. There's a section in the SNAP Getting Started Guide that discusses this. It's at the end of chapter 16 (in the NX10 version, anyway).

 

Here's an example:

 

Option Infer On

Public Class MyProgram

   Public Shared Sub Main()

      Dim session = NXOpen.Session.GetSession()
      Dim workPart = session.Parts.Work

      ' Create a parabola (which you can't do using a SNAP function)
      Dim wcs = Snap.Globals.WCS
      Dim mx As NXOpen.NXMatrix = wcs.Matrix.NXOpenMatrix
      Dim center As New NXOpen.Point3d(0,0,0)
      Dim parab = workPart.Curves.CreateParabola(center, 4, -1, 1, 0, mx)

      ' Create a SNAP curve that "wraps" the parabola
      Dim snapCurve As Snap.NX.Curve = Snap.NX.Curve.Wrap(parab.Tag)

      ' Use SNAP facilities to change its width
      snapCurve.LineWidth = Snap.Globals.Width.Width013

      ' Use a SNAP function to create a point
      Snap.Create.Point(snapCurve.EndPoint)

   End Sub

End Class

 

 

 

山田
yamada