DesignCAD 2019 and DesignCAD 3D Max 2019 now available for sale! OR

Macro for quick lines and stuff in 3D shaded mode.
Read 270 times
January 08, 2020, 08:54:20 AM

This macro is intended to alleviate the slowdowns experienced when trying to draw lines or create 3d primitives (like torus) in OpenGL shaded mode. It has lots of hoops it has to jump through, though, that might render it useless. Try it on your system to see if it helps. It works ok on my system once the drawing isn't too big.

The part that actually works is the actual drawing of lines or creating 3d primitives with no drag   :) 8)

Read comments at start for process instructions...


Code: [Select]
'Lar, 8jan20

'macro for when you are in OpenGL mode and you want to do one of those commands that would take long, like Line, Torus, move something, etc...

' macro's process: 1] switches to wireframe (which allows GDI shading while in OpenGL mode); 2] GDI shades the active window (which allows stuff to be done quickly like when in wireframe mode (won't have Mixed Mode shading right then; may not shade the same as opengl; 2d elements may not render; even though this macro have them set to; also appears that turning on gdi shading deselects stuff; in large drawings may take long to shade... all very sad)), 3] runs the setpoint command, which allows you to call up any command, eg line or torus, or move stuff... when ready to end the macro just click anywhere in a drawing window, if it doesn't return to macro by itself), 3] returns to OpenGL mode and ends...


sys(2)=0     'wireframe mode, necessary to allow GDI shading while in OpenGL mode, next...

>ShadeView   'GDI shade...
'0 = no show, 1 = show; these should show 2d stuff but desn't on mycomputer...
<ShowLine 1
<ShowArrow 1
<ShowDim 1
<ShowText 1

if count=0 then    'for repeating...

   'YOU CAN COMMENT OUT THE LINE BELOW once you get use to the macro...
message "CALL UP ANY COMMAND AND EXECUTE IT (eg Line, Dimension, Torus - something slow in Shded Mode).",CHR$(13),"   `NOTE: If command doesn't require points then after command click in drawing to end, or call other command (no regen or view command)."
end if

setpoint "Run a command (one that takes long in OpenGL shade mode), after the command click anywhere to return to macro..." 1     ' this gives user ability to start other commands (like line or torus, things that take long in OpenGL shade mode... click in drawing space (with no command running) to get back to macro...

sys(1027)=4  'message box style = Yes (6) / No (7)...
message "Go again?...",CHR$(13),CHR$(13),"(...message about calling up command will appear in status bar only)..."

'If YES(6)...
'1=OK, 2=Cancel, 3=Abort, 4=Retry, 5=Ignore, 6=Yes, 7=No...
if sys(1028)=6 then
goto REP   
end if

'if NO(7)...
if sys(1028)=7 then
sys(2)=3     'backto OpenGL... [0 = wireframe, 1 = hiddenline, 2 = flatshade, 3 = smoothshade, 4 = quickhiddenline]
end if
« Last Edit: February 10, 2020, 01:29:57 PM by Lar »


* January 11, 2020, 06:43:44 AM
Hi Lar., and thank you.
But I'm not really sure if it's working.
There's flickering when placing dimensions and when zooming in and out.
Maybe more instruction is needed, perhaps.

Windows 7 64 Bit Home Premium
HP All in one TouchSmart Desktop
Nvidia Geforce 210
Design Cad 3D max 2019
Design Cad 3D max 24

February 05, 2020, 06:01:15 PM

Hi Dean. Sorry I'm just seeing your reply. I was only clicking "show unread posts" because previously clicking that would show all the unread posts, even ones you replied in. Now with the forum changes it seems you have to click "show new replies to your posts" to see the ones you participated in.

Regarding the macro, I don't know what could have happened. I just copied the macro from my opening post and pasted it to make the same macro you guys would get and it works ok (sometimes my personal macros are less refined as the ones I post).

Here are the instructions:
1] Drawing must be in OpenGL shading mode before you start the macro (if you only use GDI shading mode then you wouldn't need this macro)...

2] Upon starting the macro the drawing's shading will switch to GDI mode. In GDI mode you (I, at least) don't experience the slow downs when creating lines and stuff like I do when creating them in OpenGL mode...

3] The "SetPoint" basiccad command will start (you will see the cursor change to you drawing cursor). DO NOT SET A POINT. Instead, call up a command the way you normally do, like pressing "V" to draw a line, or "@" to draw a dimension. Carry out the command like normal, and end it like normal.

4] Upon the called up command ending the drawing will be returned to OpenGL mode and the macro will end (just press F3 to repeat).

Here is the explanation of step 3 :

3] The "SetPoint" basiccad command will start (you will see the cursor change to you drawing cursor). With SetPoint you normally just set the stipulated number of points and then the macro continues. However, SetPoint actually allows you to call up commands and carry them out, once you call up the command before setting the required number of points. So, in this case where the required number of points is 1, once you see the cursor change to the drawing cursor, BEFORE YOU JUST CLICK 1 POINT SOMEWHERE, you call up the command you want to carry out, using any of the regular ways to invoke commands, ie, the menu, hot keys, toolbox buttons, etc. For example, if you want to draw a line press the "V" key and then go about setting the points for the line and when done press Enter. Or, to draw a dimension press"@" (ie, shift+2) and set the three points for the dimension. Once the command ends SetPoint will, in some cases, require you to then set it's 1 point... or in other cases will take the points of the command as its point and the macro will continue, in which case the window will return to OpenGL shading and the macro will end. To immediately repeat the macro just press F3 (but I see where I can improve the macro by allowing you to do more commands before you return to OpenGL).

I hope those instructions help.

« Last Edit: February 05, 2020, 06:02:52 PM by Lar »


* February 06, 2020, 05:31:54 AM
Thanks Lar,
Your prompt is what confused me " click anywhere in the drawing to continue the macro"
I started with a drawing that only contained a Box then started the macro and hit "ok"
If I do the "click" anywhere in the drawing before starting a command it appears to dis-able or end the macro. I tried drawing a Torus after doing the "click" first and there was flickering.
So, I tried it the other way by starting the Macro > hitting "ok" then went over to the toolbar and clicked on torus icon then starting drawing. There was a big improvement > almost no flickering.
Then I tried again to draw a torus and there was flickering so it appeared to work only "once"
« Last Edit: February 06, 2020, 05:44:24 AM by Dean »

Windows 7 64 Bit Home Premium
HP All in one TouchSmart Desktop
Nvidia Geforce 210
Design Cad 3D max 2019
Design Cad 3D max 24

February 10, 2020, 06:21:17 AM

I revised the text in the message. Hope it's clearer now. Once you get use to the macro you can put an apostrophe in front of 'message' so the macro will skip it out.

I intend to enhance the macro so it repeats but for now to quickly repeat the macro just press F3.



February 10, 2020, 01:39:38 PM


I revised the macro again so it repeats as many times as you wish, by choosing YES when asked. When you answer NO the macro will end. So if you click without calling up a command you will be presented with the YES/NO question again.

However, for this concept to work it requires that the drawing be wireframed and then GDI shaded between commands, which could be very slow in a big drawing. You won't see the OpenGL shading until the macro ends (so no mixed mode shade until then).