Jump to content
Developer Wiki and Function Reference Links ×

Toggle view script for any Class


Christiaan

Recommended Posts

I took a toggle guides script:

IF ((GetCVis('Guides')) = 0) THENBEGIN HideClass('guides');ENDELSE ShowClass('guides');END;

And tried to convert it for another Class we have (In House Info-Activity Zones):

IF ((GetCVis('In House Info-Activity Zones')) = 0) THENBEGIN HideClass('in house info-activity zones');ENDELSE ShowClass('in house info-activity zones');END;

But I've done something wrong because it doesn't work. Can someone help me out?

Link to comment
Why are you using Capitals in the first name of your class and no capitals in the others?

I was following the format of the Guides example.

It's that, Be sure you use correct strings.

Changed them to caps but still doesn't work:

Line #1: IF ((GetCVis('In House Info-Activity Zones')) = 0) THENBEGIN HideClass('In House Info-Activity Zones');ENDELSE ShowClass('In House Info-Activity Zones');END;

|

{ Error: Identifier not declared. }

|

{ Error: Expected THEN }

|

{ Error: Did not expect this after end of statement - missing ;? }

|

{ Error: Identifier not declared. }

Link to comment

Line #1: IF ((GetCVis('Guides')) = 0) THENBEGIN HideClass('guides');ENDELSE ShowClass('guides');END;

|

{ Error: Identifier not declared. }

|

{ Error: Expected THEN }

|

{ Error: Did not expect this after end of statement - missing ;? }

|

{ Error: Identifier not declared. }

Link to comment
Why not just toggle (switch) the Class visibility state using the Navigation palette. Quick and effortless.

To avoid having to scroll and find it first. There are a group of view toggles that we use quite a bit so I've elected to put them in everyone's context menu:

Toggle Guides

Toggle Activity Zones (a class we use to show activty zones around furniture, etc.)

Toggle Zoom Line Thickness

Toggle Objects in Group

Toggle Viewport Crop

Link to comment

Just a few comments to pull this thread together.

1. Variable and Constant (and procedure and function) names in vectorscript are NOT case sensative. Foo, FOO and foo are all read exactly the same by the compiler.

2. Begin and End statements are used to group a block of statements into a single logical group. You don't need them unless you have more than one statement between them.

3. If you do not use variable or constants in a vectorscript, you don't have to declare it a procedure. If you followed Petri's advise and specified a constant, you would have to the whole script a procedure and use a Begin/End and a Run statement.

4. If this is the entire script, the END; at the end of the script is not needed. Every End should have a matching Begin, and vice-versa.

5. Note that there is no semi-colon after the end before the Else. It is required to be this way. It is part of how If/Then/Else statements work.

6. If you use better formatting, it is often easier to debug VS. Here is the way I would have layed out the script. Remember, white space is ignored by VS.

IF ((GetCVis('In House Info-Activity Zones')) = 0) THEN

BEGIN

HideClass('in house info-activity zones');

END

ELSE ShowClass('in house info-activity zones');

Pat

Link to comment
  • 6 years later...
  • 1 year later...

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...