Jump to content

Create Viewport Script Keeps Crashing Vectorworks


Recommended Posts

Hi Everyone,

 

This script keeps crashing Vectorworks when I execute it. I have it as a custom plugin, assigned to a menu drop down, and typically recall it through a hotkey. I tried isolating the line that is giving me issues by commenting out all the others and it looks like the "Create Viewport" command is the culprit. I also tried adding wait commands at different sections of the script and that didn't help either. I was hoping someone could help diagnose what I am doing wrong.

 

The script is designed to turn off dark background, turn off layer colors, change the layer options, set the render mode to wireframe, and then create a viewport and open the viewport dialogue window.

 

SetPref(16, FALSE);
SetPref(11, FALSE);
SetPrefint(506, 3);
DoMenuTextByName('Wireframe Render Chunk', 1);
DoMenuTextByName('Create Viewport',0);

 

Thank you,

Maxwell

Edited by MTRobin
Link to comment
On 2/22/2021 at 6:05 PM, JBenghiat said:

Could you please help me set these up? I don't have much experience with handles. I want to use the handle of the currently selected layer. Pretty much just recreate the DoMenuTextByName commands.

 

Thank you,

Maxwell

Edited by MTRobin
Link to comment

To create a viewport on the current layer, the script is as easy as:

viewHand:=CreateVP(ActLayer);

The viewHand variable (or whatever you want to call it) is a handle to the viewport so that you can set crop and visibilities using SetVPCropObject, SetVPClassVisibility and SetVPLayerVisibility.  The ActLayer command will return the handle to the currently active layer.

Link to comment
17 minutes ago, Jesse Cogswell said:

To create a viewport on the current layer, the script is as easy as:


viewHand:=CreateVP(ActLayer);

The viewHand variable (or whatever you want to call it) is a handle to the viewport so that you can set crop and visibilities using SetVPCropObject, SetVPClassVisibility and SetVPLayerVisibility.  The ActLayer command will return the handle to the currently active layer.

Thank you. I got this to work, but it's not quite what I'm looking for. This creates a Viewport on the current layer, but what I am trying to achieve is to open the "Create Viewport" dialogue to place a viewport on a sheet layer.

 

Thank you,

Maxwell

Link to comment

Ah, I see.  That is much trickier, as you would basically have to recreate the dialog window in order to use the direct API calls.  In this case, the DoMenuTextByName is probably the way to go.  I tested this quickly in VW2019 and didn't have any troubles crashing.  What version are you using?

Link to comment

Vectorworks does create a .dmp file when it crashes as well as a log file (my current log file for VW2019 that I use every day is currently 56,000 lines long, but is timestamped per line, so if you know when you crashed, you should be able to find some information).

 

On Windows, it is stored in your User Folder.  So if you go to Tools - Options - Vectorworks Preferences and go to the User Folders tab and click "Explore" (or "Open in Finder" on Mac), it should open up the location of the logs.  You will probably have to send the .dmp files to VW to get answers unless you have a debugging program that can open them and are comfortable with navigating them.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...