Open .dxf file with view
Thread Split: Some posts in this thread were moved from here

Next
 From:  Unknown user
9154.1 
Hi Michael. When you click on a dxf file, it opens by default in Moi 3D and automatically put the desired view. For example upper. How can this be done?

Vladimir.

EDITED: 28 Nov 2018 by MICHAEL GIBSON

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9154.2 In reply to 9154.1 
Hi Vladimir,

re:
> Hi Michael. When you click on a dxf file, it opens by default in Moi 3D and automatically
> put the desired view. For example upper. How can this be done?

It's probably possible but it will involve modifying the operating system's file association for .dxf files to add a .js script file as an additional command line parameter when MoI is launched by the operating system. MoI will then run that script after the file is opened and you could have the script do various things like set a particular view.

What operating system are you running?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9154.3 In reply to 9154.1 
Hi Vladimir, you wrote:

> > What operating system are you running?
>
> Windows 7 64bit.
> Vladimir.

And does MoI currently launch when you double click on a .dxf file? Or does some other program launch when you do that?

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Unknown user
9154.4 In reply to 9154.3 
Opens in Moi3D by default.

Vladimir
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
9154.5 In reply to 9154.4 
Hi Vladimir, so you'll need to edit the open command that the operating system shell uses to launch MoI when you double click on a .dxf file. That will be in the system registry so you'll need to run regedit.exe .

Inside regedit do Ctrl+F and search for MoI.DXFFile.1 - that's an entry that the MoI installer will set up as the progid to use for opening files with the .dxf file extension. If you have manually set up the handling for .dxf files instead of having the default that the MoI installer sets we may need to look somewhere slightly different (You'd need to instead search for .dxf and see what "OpenWithProgids" are set for it and then look for that progid).

But if you have MoI.DXFFile.1, expand it and there are 2 child entries below it named "DefaultIcon" and "shell". Expand shell down to shell > open > command and highlight "command". Now on the right-hand pane there should be a value set like this:

"C:\Program Files\MoI 4.0 beta Oct-17-2018\moi.exe" "%1"

This is the command line that the operating system will use for opening a .dxf file - it's saying to run moi.exe and the %1 part will be the .dxf filename sent in to moi.exe as a command line parameter. The " " quotes around those are needed to make text with spaces in it treated as one single parameter.

So you'll need to modify that to add an additional parameter for a .js script file, like this:

"C:\Program Files\MoI 4.0 beta Oct-17-2018\moi.exe" "%1" "c:\scripts\opendxf.js"

Then you'll need to create a text file at c:\scripts\opendxf.js (or wherever you wish it to be, just make sure to put " " around it if it has any spaces) and that script file should then run after a .dxf file is opened from the OS shell.

The contents of the opendxf.js file can do various things, to set the top view to be maximized try putting this inside of the .js file:

moi.ui.mainWindow.viewpanel.mode = 'Top';

Let me know if that does not work, I have not tested it here yet.

- Michael

EDITED: 28 Nov 2018 by MICHAEL GIBSON

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
 From:  Unknown user
9154.6 In reply to 9154.5 
Hi Michael.
Thank you very much for your comprehensive explanation.
Everything works very well. My thanks for you will be in the form of buying Moi 3D v4 :) good Luck.
But I'll be back with questions.

Also configured opening of ai and eps files using one script.

Vladimir.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All