AlbertoB Posted April 18, 2008 Share Posted April 18, 2008 When VW document is in "EditGroup" or in " Edit Viewport Annotaion" simple script commands doesn't work. Is there any part of code to add to force them start ? Thanks. AlbertoB. VW 12.5.2 Mac OSX 10.4 Quote Link to comment
Pat Stanford Posted April 18, 2008 Share Posted April 18, 2008 Can you post the script that does not work in the annotation? It is easier for us to help fix it that to throw out ideas that might not apply. Pat Quote Link to comment
AlbertoB Posted April 18, 2008 Author Share Posted April 18, 2008 I've just discovered that they doesn't work only in which scripts where I've used FSActlayer function to get an handle to the first object selected in the active layer. I often use this method: select an object (line, arc, text etc.) to get some information to draw another entity. FsActlayer works fine but not in "Edit Group" mode. P.S.: Other scripts work. Quote Link to comment
Pat Stanford Posted April 18, 2008 Share Posted April 18, 2008 You are right. And there is not a really easy work around. The traditional test to determine where you are working (Design Layer, Group, Annotation) is to insert a locus point, GetParent of the locus, get the type of the parent object and delete the locus If the parent is a group, then you need to use GetVPParent to see if it is an annotation or just a group. If the parent is a group, use FInGroup to get the first object. If the parent is an annotation, use FInGroup(GetVWGroup(Handle,2)) to get the first annotation. In either case you then need to check if the first object is selected and if not then use NSelObject to step through until you get the first selected object. If I get a chance, I may write a function to do this as a single call. In the meantime, here are the test scripts I used to figure this out. Pat ********* Procedure Test; var H1:Handle; N1:Integer; Begin H1:=FSActLayer; N1:=GetType(FSActLayer); If N1=11 then Begin H1:=FInGroup(H1); While not Selected(H1) do H1:=NextSObj(H1); N1:=GetType(H1); end; If N1=122 then Begin H1:=FInGroup(GetVPGroup(H1,2)); While not Selected(H1) do H1:=NextSObj(H1); N1:=GetType(H1); end; Message(date(2,2),' ',N1,' ',H1); end; Run(test); ********** ********** Procedure Test2; Var H1,H2,H3:Handle; Begin Locus(0,0); H1:=LNewObj; H2:=GetParent(H1); If GetType(H2)=11 then H3:=GetVPGroupParent(H2); If H3 = Nil then Message(date(2,2),' ',GetType(H2)) else Message(date(2,2),' ',GetType(H3)); DelObject(H1); end; Run(Test2); ********** Quote Link to comment
BillW Posted May 26, 2008 Share Posted May 26, 2008 I have dug out some code I use to check if inside a group or viewport. Regards Bill Wood function checkstatus : BOOLEAN; Var objty : INTEGER; btest : BOOLEAN; begin locus(0,0); objty := gettype(getparent(Lnewobj)); delobject(Lnewobj); btest := (objty = 31); {Layer} if NOT btest then alrtdialog('Exit current editing mode first'); checkstatus := btest; end; Quote Link to comment
Yotarou Posted June 3, 2008 Share Posted June 3, 2008 Is this useful for you? http://techboard.vectorworks.net/ubbthreads/ubbthreads.php?ubb=showflat&Main=17161&Number=77285#Post77285 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.