Assembly Posted December 2, 2009 Share Posted December 2, 2009 Does anyone know what is the script function behind the convert to group menu?. I have inserted a custom object in a script. I would like to convert it to a group. Quote Link to comment
Kool Aid Posted December 2, 2009 Share Posted December 2, 2009 (edited) Use BeginGroup; { object creation } EndGroup; EDIT What nonsense? I have to learn to read the questions? Edited December 2, 2009 by Kool Aid Quote Link to comment
Pat Stanford Posted December 2, 2009 Share Posted December 2, 2009 If it is an existing object (rather than something you are creating with VS), then just make sure it/they are selected and use DoMenuScriptByName('Group Chunk',1); Quote Link to comment
Assembly Posted December 2, 2009 Author Share Posted December 2, 2009 the object is a custom pio. i thought that DoMenuScriptByName was not advisable. I have tried to use ungroup; SymbolToGroup(objecthandle,1); Documentation says that 1: Convert plug-in and symbol subobjects. this has not been successful Why I want this function. I have a PIO that creates 3 extrudes used to to SubtractSolid from a number of other PIO's. I think if I can convert to a group I can get a handle to each object in the group. Any other suggestions?. Quote Link to comment
Assembly Posted December 3, 2009 Author Share Posted December 3, 2009 Here is a code to create objects called 03Extrudes Procedure ChangeThis1; VAR hobject: handle; BEGIN; BeginXtrd(0,300); Rect(0,0,100,200); EndXtrd; hobject:=HDuplicate(LNewObj,0,400); hobject:=HDuplicate(hobject,0,400); END; Run (ChangeThis1); Next is code to create an object that inserts the above object then uses a document list to count the objects inside. Procedure ChangeThis1; VAR Handobject: handle; PIOHandle: handle; PIOrecordhandle: handle; PIOwallhandle: handle; hobject: handle; objectname: String; i: integer; PROCEDURE CreateObject(object2Create:String); BEGIN; objectname:=object2Create; hobject:= CreateCustomObjectN(objectname,0,0,0,False); Hmove(hobject,200,0); END; BEGIN; CreateObject('03Extrudes'); i:=1; HUngroup(hobject); DoMenuTextByName('Convert to Group',2); SymbolToGroup(hobject,1); Handobject:=FIngroup(hobject); WHILE Handobject <> NIL DO BEGIN i:=i+1; Handobject:=NextObj(Handobject); END; message(i); END; Run (ChangeThis1); Can't get access at all Quote Link to comment
ccroft Posted December 4, 2009 Share Posted December 4, 2009 Can't get access at all Hi Justin, Are you saying that you can't get access to the group? Wouldn't surprise me if this was true. Fairly sure hobject is nil after you call HUngroup(hobject) After CreateObject, hobject is handle to placed PIO, no? Quote Link to comment
ccroft Posted December 4, 2009 Share Posted December 4, 2009 I just spent a little time fooling with your script and couldn't access 'Convert To Group' either. I could get the script to place a PIO, group it using ('Group Chunk',1) and count the one PIO inside it.... The appendix says that the selector is 'Convert to Group Chunk' but that didn't seem to work with any index. Thing is, it's not part of a chunk. If it's part of any chunk it would be the Convert chunk, but all the other Convert commands are not part of any chunk and would be called like ('Convert to Lines',0) And it didn't work as simply ('Convert to Group',0) either. I didn't work with it that long, so maybe I'm missing something but it does look a little bug-like. This kinda illustrates why DMTBN isn't recommended. Custom workspaces and changes to workspaces made in product updates can break the script. What I keep wondering is why you don't make this simple PIO a procedure in the parent that takes the needed parameters, rather than taking on the whole child/parent thing. Of course, I've no idea where you're headed with this. Guess I'm not much of a family guy. Quote Link to comment
Assembly Posted December 8, 2009 Author Share Posted December 8, 2009 Thank for trying Charles. What we are doing is complex: There are 20-30 components in the PIO that make up a part. The assembly of the component is a straight forward stack. Each component has a size. The height of the last component is simply all the previous ones thickness added. But height is not the only location consideration. Object shift in all 3Ds as the final part is created. Add in complexity that some objects rotate which affects clipping of other objects, Then add a the ability to give components options, ie this part is timber or aluminum, and you quickly get a significant number of objects to manage. The parent child method allows breaking up of the code into discrete object. This is very useful. First it allows for simple testing of the component parts before they get introduced to the larger model. Second the division allows for more than one person to work on the bigger project, as multiple people can script the parts. The clip tool is a straight forward, yet complex, shape. The shape stays the same but changes scale on each clip. Currently we have the clip shape hardcoded into each component. This is okay for now, but if any change is required to the clip shape, then there is an expanding list of scripts to cut and paste the clip procedures. (thank you bbEdit for your mulit search you may be called on soon) My aim with my last few posts is to be able to ring fence the cliping object in one pio. No luck so far. Quote Link to comment
Jessica S Posted February 5, 2010 Share Posted February 5, 2010 Use BeginGroup; { object creation } EndGroup; EDIT What nonsense? I have to learn to read the questions? Hi ! I've just visited this forum. Happy to get acquainted with you. Thanks. 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.