Jump to content
Developer Wiki and Function Reference Links ×

FprEachObjectIn Layer


BobD

Recommended Posts

Hi Bob

If you just can't get FEOIL to work you can write your own loops nested within loops:

hgroup:=FInLayer(hlayer);

WHILE hgroup <> NIL DO BEGIN

hpart:=FInGroup(hgroup);

WHILE hpart <> NIL DO BEGIN

{do something;}

hpart:=NextObj(hpart);

End;

hgroup:=NextObj(hgroup);

End;

This will do one referenced layer. You would need either another loop enclosing this to run thru all layers, or perhaps call this as the action function in ForEachOjectInList using Flayer for the list handle.

I sometimes use this approach cause it's easier to see and control what's going on .... for me anyway.

Charles

Link to comment

Hello All,

I have hierachical plug-in object where one parent includes a number of children objects.

I need to traverse all the objects on a layer,

do some calcs and then write an output file.

I tried to use ForEachObjectInLayer to filter the

objects by layer and at the same time get down into any hierarchy. It does not seem to work as it will only find the parent objects even with the

correct object, traversal and layer options set.

When set to look at all layers, I do get a list of objecthandles, but no names are returned.

Anyone know how to get this to work? Without this capability, I have to manually ungroup each

parent object prior to processing and then re-group them when done.

Thanks for any input.

Link to comment

"Function GetName returns the object name of the referenced object. The function returns None if the object has no object name"

They do have names....right?

I ask this because you do mention traversing groups. Groups don't have object names as far as I know.

I use a number of symbols that are inserted as groups so they can be edited graphically. The name does not transfer from the symbol to the resultant group.The symbols have attached records and one of the fields is "Name". The record remains intact.

Does this sounds familiar in any way? I imagine this same thing would happen if you're creating groups within your PIO.

c.

Link to comment

Charles,

Perhaps GROUP is not the correct nomenclature.

I have a plugin that contains parameters that

I grab and then call CreateCustomObject from within the Plug In to create other objects.

There are no explicit Group/End Group calls being made. When I run the plugin, and then display the

layer, all the objects created within the parent plug in are grouped.

I then have another plug in to do the traversal.

Within the traversal program, I do a ForEachObject call for each plugin object created and supply criteria R=pluinobject_name & Layer= layername.

Within VW, I display the layer with all the objects, run the traversal plug in, and, unless I

explicity ungroup the parent object, I can not get the object names. If I do an ungroup, then

I can get all the names and can do the traversal

correctly.

If I run VW export database and select one of the

child records, the system can find all the child objects, even without doing an ungroup.

If I run VW export vectorscript, it will not output the child records unless the ungroup is

done.

Whew!

Bob

Link to comment

Nice explanation! This stuff can get hard to talk about.

Questions:

1) What kind of objects are you using CCO to create inside the PIO?

2) What do you need their names for and how many different names are there?

3) Are the child records PIO parameter records or attached record objects you can access with the Data pane of Object Info?

Link to comment

I am creating plugin objects from within the plugin. These consist of straightforward 2D parts

to a typical door - stiles, rails, etc.

I am using their names within the traversal code to recognize the particular part and generate a spec of the part in the output file.

So, the children are all PIO parameter records.

When I select the parent, I get it's object info.

If I need to muck with the parts, I can ungroup

the parent and select individual parts and get their info via object info.

Link to comment

I do this with cabinets, but I use classes to distinguish the parts.So I have 'fronts','bottom','drawer box', etc. The pio calls the class, creates the parts, calls the next class etc.

I also sometimes use an attached record and pull a name off that.

The difference is that my parent PIO contains only simple extrudes, rather than more PIO's. FEO finds my parts and recognizes by class.You might consider drawing your parts directly without using CreateCustom, and naming them by class assignment. This assumes that the only reason you're making the parts as PIO's is so they can carry a name.

I also find this useful in that the graphic attributes of the parts can easily be controlled thru class attributes.

I really don't understand why the ForEach calls don't get you the names of the kid PIO's though. Maybe you should post the script for the ActionFunction and the CreateCustomObject calls?

I have zero experience with family style PIO's, but somebody here might be able to help if they can see your script.

Later

Charles

Link to comment
  • Vectorworks, Inc Employee

I'm kind of lost at the moment on the structure of the PIO. It sounds like a PIO that contains other PIO's.

In order to get the name of a PIO look at the name of last record attatched to the object. It should be the name of the PIO. You can get the values from this record.

If you are using criteria make sure you use INOBJECT so it will look inside of PIOs.

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