Jump to content

Go inside a group using VectorScript

Recommended Posts

Hello, tongue.gif

Can anyone help me with the following problem. I have 3 objects grouped (circle, square and line). Without ungroup them, I have to go inside the group with VectorScript and get the individual properties (like Penfore, Penback, FillFore and FillBack).

Can someone tell me which VectorScript instructions I have to use to go inside the group, select the individual objects and get their properties for each of them. When this action is complete, they still have to be the same group.

I thought the following way. Move the group to an empty layer. Ungroup the group and select all the individual elements on that layer. Get their properties and after that select all objects again. Group them again and send this group back to their original layer and position. Then delete the empty layer again. This seems a rather complicated and no good method to me.

We use VectorWorks 8.5.2 on a Mac G4.

Please, can you help me. I will appreciate your help very much and I thank you in advance.

I wish you a very nice day and I hope to receive a solution for my problem. If I can help you with anything about VectorScript, feel free to ask, I will help you.

With friendly greetings,

StarGate smile.gif

Link to comment

There's a function that returns the first object inside a referenced group:


FUNCTION ??FInGroup (?ObjectHd:HANDLE?) :HANDLE ; 

And another that lets you traverse a list of objects:



Using these, you should be able to write something like this:


myHandle := FInGroup(someHandleToYourGroup);

while (myHandle <> nil) do begin

{do something here with myHandle}

myHandle := NextObj(myHandle);


I haven't tried that code out, but I think you'll get the general idea.

Also, consider posting VectorScript-related questions to the VS forum rather than the general discussion one, as you'll attract the attention of more people with the same interests and questions there.

Hope that helps.

[This message has been edited by Caleb Strockbine (edited 10-20-2001).]

Link to comment

Hello Caleb,

Thank you very much for your help. I appreciate it very much. I will try it today and I will let you know the results.

You know, if I can help you with something, feel free to let me know. It will be done with pleasure.

I wish you a very nice day and all the best I can wish you.

Friendly greetings,


Link to comment


As promised in my last message I will give you the complete code for the group solution. You will find the complete code under this message. Copy and paste the complete listing in your VectorWorks VectorScript editor, draw an unlimited number of grouped, nested group objects and so on in your document. Give them different colors and you will see that when the script finished, all colors changed color. The dark colors have no meaning, they are the last group the script encountered. Inside the script the position is marked where you have to place YOUR code. You need to place the same code in two locations. Probably you can use a procedure call.

In case you have problems or need more information, feel free to contact me on the email address mentioned in the code listing.

I wish to thank Caleb Strockbine for his help on developing this script.

I wish you a very nice day and I hope you will enjoy working with VectorScript as I do.

With friendly greetings,


Here is the complete listing :

procedure GroupTest;

{ This procedure goes inside a group and get the individual color properties of }

{ of the different members of the group, even when they are other groups. }

{ The number of groups which can be searched is unlimited }

{ Also note that the PARENT - CHILD relationship changes depending on the group }

{ on which another group is linked. }

{ I also have to admit that I never would succeeded in developing this script }

{ without the help of Caleb Strockbine of Nemetschek, which I thankfully accepted. }

{ StarGate - Email : kristiaan.verberne@skynet.be }

{ If you use and adapt this code, please let the message below untouched, thank you. }

{ In memoriam of all innocent and good people, who died on 11 september 2001 at W.T.C. }

{ Their sacrifice will never be forgotten and they will live on in our memories. }


hndLayer:handle; { Active layer }

hndObject:handle; { Selected object on active layer }

hndGroupParent:handle; { Parent group }

hndGroupChild:handle; { Child member of Parent group (member) }

LintRed:longint; { Red part of color only used to show result }

LintGreen:longint; { Green part of color only used to show result }

LintBlue:longint; { Blue part of color only used to show result }


hndLayer := ActLayer;

hndObject := FSobject(hndLayer);

if hndObject <> NIL then

begin { There is an object selected... }

if GetType(hndObject) = 11 then

begin { and the selected object is a group }

hndGroupParent := FInGroup(hndObject);

while (hndGroupParent <> NIL) do

begin { process individual groupsmembers }

{ $$$$$$$$ BEGIN OF YOUR CODE for PARENT }




hndGroupParent := NextObj(hndGroupParent);

if GetType(hndGroupParent) = 11 then

begin { There is another group present inside the parent group }

hndGroupChild := FInGroup(hndGroupParent);

while (hndGroupChild <> NIL) do






hndGroupChild := NextObj(hndGroupChild);

end; { End while childgroup }

hndGroupParent := NextObj(hndGroupParent);

end; { End of childgroup }

end; { End While }

end; { End if GetType }

end; { End if hndObject }



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.

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