Jump to content

PIO/Symbols in wall


Recommended Posts

Hi all, I have two questions regarding the windows/doors in the walls:

  1. Given a handle of a wall, how can I find the handles of PIO(doors, windows) that are added to this wall?
  2. I use vs.CreateDuplicateObject(h_wall, vs.Handle(0)) to duplicate the wall. I noticed that if there are doors or windows in the wall, they are automatically copied along with the wall. How can I duplicate only the wall itself?
Link to comment

One way that you could do it is to use vs.ForEachObject(Execute,('T=PLUGINOBJECT')) with the Execute callback checking that the parent handle of the given object matches the handle of the wall using vs.GetParent.  My Python isn't the strongest, but below is a very simple demonstration in Vectorscript of counting objects within the selected Wall that should give you the general idea.

 

PROCEDURE CountEmbedded;

VAR

	counter:INTEGER;

PROCEDURE Execute(h:HANDLE);

	BEGIN
		IF(GetParent(h) = FSActLayer) THEN counter:=counter + 1;
	END;

BEGIN
	counter:=0;

	ForEachObject(Execute,(T=PLUGINOBJECT));
	
	AlrtDialog(Num2Str(0,counter));
END;

Run(CountEmbedded);

 

Keep in mind that this is a bit of a brute force method, since it needs to test all Plug-in objects in the drawing.  I was not able to find a set of criteria that could narrow the search to just doors or windows, or just embedded objects.

Link to comment

@Jesse Cogswell Thanks! I wrote a Python version to output handles of the nested PIOs within a given wall:

from functools import partial

def get_nested_pios_in_wall(wall_h):
    def find_related_pios(pio_h, wall_h):
		pio_list = []
		h_wall_found = vs.GetParent(pio_h)
		if h_wall_found == wall_h:
			pio_list.append(pio_h)
		vs.AlrtDialog(str(pio_list))
    
    partial_find_set_related_pios = partial(find_set_related_pios, wall_h=wall_h)
    vs.ForEachObject(partial_find_set_related_pios, "T=PLUGINOBJECT")

 

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