Jump to content
Developer Wiki and Function Reference Links ×

Does Class Exist


michaelk

Recommended Posts

Miguels suggestion works if you know the whole name of the class. If you want to get classes whose name CONTAINS a substring I think you will have to loop through the class list.

I just tried ForEachObject and it appears to filter out classes.

It also appears that using '*' as a wildcard in a N='*None*' for example, does not return anything unless there is a character before the None while the final * allows for a zero length string.

I am filing a bug.

Link to comment

From the VW2011 VS Function Reference:

PROCEDURE NameClass

( className:STRING ) ;

Description:

Creates a new class in a Vectorworks document, which then become the active class.

If the specified class already exists, then it will become the active class of the document.

Note: Class names cannot exceed 20 characters.

If you use NameClass, it does not matter if it exists or not, it will simple become active.

Probably faster/easier to just get the active class, NameClass, reset active class than check for existance.

Link to comment

Pat

I'm actually trying to create the classes if they don't exist and set all of their by class attributes.

I think I understand most of it - except for textures.

There is a SetClUseTexture (boolean) but no GetClUseTexture. Am I missing something?

And how does one set which texture to use?

Thanks

MK

Link to comment

Michael -

Here is a Function that I use that I believe Gerard Jonker wrote a while ago that does exactly what you're needing, assuming you know the name of the Class:

{----- Function to Determine Existence of Given Class -----}

function existclass(Cstr : string) : boolean;

var

ci:longint;

stop:boolean;

begin

ci:=0;

stop:=false;

while stop=false do

begin

ci:=ci+1;

if Cstr = classlist(ci) then

begin

stop:= true;

existclass:=true;

end;

if ci = classnum then stop:=true;

end;

end;

If the Class doesn't exist, you can then store the active Class, create the new one and set it's attributes, and then "reactivate" the stored Class.

Link to comment
  • 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...