News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Turning layers off in a macro with version 23

Started by accuratesteel, October 22, 2013, 07:22:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

accuratesteel

I have a macro written long ago and part of the program turns layers off based on user input. (Layer (12)=0) is the statement I use. Running the program with version 23, I don't get an error, but the layers don't seem to be turning off. Has anyone else had this problem?

accuratesteel

dcadRob

#1
Does the macro actually run? It might not be found in a folder by V23.
Is 12 your current layer?

Do you do a REGEN?

accuratesteel

dcadRob, The macro does run, 12 might not be the current layer and I do regen
accuratesteel

Bob P

This seems to work.
'Program loff.d3m 
'Command line syntax: loff <layer to be turned off>

layy$=sys$(0)  'Get command line argument
if layy$ = "" then input "Enter layer number: ", layy$  'If no argument, ask for one
dl = val(layy$)

if layer(dl)>13 then goto clused  'Check if the layer is the current one

layer(dl)=0

>RegenerateAll
{
}
goto end

clused:

window 6,48
locate 2,9
Print  "You are trying to hide the current layer!"
locate 4,13
Print "Press a key to exit"
anykey

END:

dcadRob



accuratesteel

Here is the drawing which the macro pulls up in case it helps.

accuratesteel

dcadRob

I cut and pasted a section of your code (IF M$= "Y" AND TD$= "Y" THEN) and it turned layers off correctly.

Is there a specific section which does not work or is all of it a problem?

I noticed that you don't check capitalization. Are all your "Y"  and "N" variables in upper case?

Did you make any changes recently?

accuratesteel

I just ran the program, making sure of using upper case Y or N and it worked fine. I think it has been to long since I ran the program. Thanks for the help.

Accuratesteel