ge25yak Posted June 3 Share Posted June 3 Hi all, I have two questions regarding the windows/doors in the walls: Given a handle of a wall, how can I find the handles of PIO(doors, windows) that are added to this wall? 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? Quote Link to comment
Jesse Cogswell Posted June 3 Share Posted June 3 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. Quote Link to comment
ge25yak Posted June 3 Author Share Posted June 3 @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") Quote Link to comment
Recommended Posts
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.