Jump to content

Assigning a default class to plant symbols


alexrv

Recommended Posts

Hi all,

I think I understand how the "enable auto-classing" works. Is it by putting a plug-in object on the dwg and as soon as you drop it the object is put in a class that it was assigned to or it will create one if it is not existing already? Like the door symbol? If this is so, how can I get place plant tool to do the same? Like I want the trees on one default class and shrubs and gcs on its own default classes too. I dabbled a little on scripting,and I tried script editor to put in a default and it works but it puts all of them in one class. If someone knows also about scripting and how to solve this, chime in please. The reason for this is for easier selection and editing of the type of plants without having to select each one manually. Also I don't have to worry about plant symbols not being in the proper class. Now if there is another way to accomplish this then I'm all ears.

Link to comment

You can specify what class the tag is to go into in the plant definition. The script editor will allow you to set a class for new plant objects but you are correct, all plants must go into one class.

In my case I use classes to categorize plants as new , existing, or remove so one class doesn't work - nor would any auto-class that is part of the plant definition or tools.

The Plant Category (eg tree / shrub / etc) is stored in the plant record and you could use a script to select only plants of a specific category...

Link to comment

Here's part of the reason why I wrote my own Plant Placement tool... Depending on what kind of plant one chooses, it'll be in the correct class.

Why did I reveal it here - oh my! A certain Mr Robert Anderson, Vice President of NNA, has just told me that whatever good ideas I have and are brought into his attention, he'll copy into NNA's plug-ins. Well, imitation is the sincerest form of flattery... At least Mr Anderson copies from the best - good on him!

Nevertheless, reclassifying objects post factum by record data is quite a trivial scripting exercise.

PROCEDURE ClassifyByData; { ? Petri Sakkinen 2001 - 2007 } 
CONST
   rName='Data';
   fName='Class';
VAR 
   obHd : HANDLE;
   theClass : STRING;

PROCEDURE DoIt (h : HANDLE);
BEGIN
   theClass:=GETRFIELD(h, rName, fName);
   NAMECLASS(theClass);
   SETCLASS(h, theClass); 
END;

BEGIN
   FOREACHOBJECT(DoIt, (R IN [rName]));
END;

RUN(ClassifyByData);

Just change the constants to be the record name and field name in question. Of course in my actual working version the method is better, but I'll give Mr Anderson something to do besides copy & paste, so he can claim to be The Creator.

EDIT

By 'constants' I mean the two assignments after CONST.

Edited by Petri
  • Like 1
Link to comment
  • Vectorworks, Inc Employee

Alex, copy Petri's script. Then create and name a new VectorScript resource using the Resource editor. When the VS editor window opens, paste his script into it. Now you have a "Document script" (one that is saved with your document as a resource). All docuemnt scripts are contained in "script palettes" (you will have created a script palette to make your script itself in the resource editor). To run a script from the script palette, just double-click it.

HTH, Robert

Link to comment

I should have thought this before: one may want to have a class prefix like "PLANTS-"

Add that in constants:

prefix = "PLANTS-";

then change

theClass:=GETRFIELD(h, rName, fName);

to be

theClass:=CONCAT(prefix, GETRFIELD(h, rName, fName));

A palette script is definitely easier to create (and to modify for different needs) than a menu command. A palette can be imported to new files.

Link to comment

I think the Plant Database requires some refinements to enable users to more easily grab groups of Plants as they wish.

For example when creating reports - Plant Legends as I call them. Sometimes I may wish to have say Trees, Shrubs and Groundcovers each under their own headings.

It may be difficult to implement - I do not know - within the Plant Database we need a user definable set of records rather than the Categorys as supplied by VW within the Database.

In Oz Julian has done things a little differently and it works better.

Link to comment
  • 2 weeks later...

In trying to get the script to recognize the plant category, the plants that I put on the drawing doesn't seem to pick up the proper plant category. It just list "plant category" in the field in the oip>data tab. So I go in the plant's definition to check if the plant cat. is selected appropriately and it is and so i click all the oks to go back to the drawing and now it is updated in the oip. I don't want to have to do this for each plant that I introduce to the drawing. Is there a way to streamline this? Am I applying the script wrong?

Link to comment

Well, somehow you have to tell the system what the type of each plant is - tree, shrub, perennial or whatever. The script is for those situations where the type or category is in the database. If it isn't, then it won't be helpful at all.

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