Musisback Posted August 12, 2010 Share Posted August 12, 2010 I would like my 2D path POI's to be drawn after a certain amont of clicks. I actually want this number to be set in de PIO definition and not by the user with a double click Thanks, Quote Link to comment
maarten. Posted August 12, 2010 Share Posted August 12, 2010 (edited) Do you want that the 2D path gets drawn immediately when the user gets to the maximum clicks and then can't click anymore, or do you want that the user can click as long as he wants and that after he ends it (by double clicking), the path only draws the maximum of points? The second option isn't so hard, just save all the points into an array and when you start drawing, just ignore the points that gets above the maximum For Integer:=1 TO Maximum DO DrawObject; For the second one, i think that the easiest way is to make 2 plug ins. One 2D Path pio and one tool. In the tool you use something like: FOR cnt:=1 TO maximum DO GetPt(x[cnt],y[cnt]); BeginPoly; FOR cnt:=1 TO maximum DO AddPoint(x[cnt],y[cnt]); EndPoly; h:=CreateCustomObjectPath('name of 2D Path pio',LNewObj,NIL); EDIT: didn't test it, but i think it should work. Edited August 12, 2010 by maarten. Quote Link to comment
Pat Stanford Posted August 12, 2010 Share Posted August 12, 2010 I think maarten is right. If you need to limit the number of clicks, you need to get the points separately and then create the PIO rather than trying to use the built in PIO functionality. Quote Link to comment
Musisback Posted August 13, 2010 Author Share Posted August 13, 2010 Thanks, but the problem with this technic is that there is no snapping between the different point of a getpt. I need at least the horizontal and vertical snapping. I tried to use de getline procedure, but then, the snapping to extention lines does not work anymore. So, I have 3 choices, but none of them is good: -I can use dirrectly the 2D Path object insertion tool. but then the users have to double click to finish. (after 2 click for example) -I can use getline but for some reason that I cannot understand, the snapping to extension line doesn't work for the first click. -I can use getpt or getptL (where the snapping always work for the first click). But then there is no horizontal or vertical snapping between the different points I posted 2 other post to find a solution, but nothing yet!!. http://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Main=29442&Number=143716#Post143716 http://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Main=29439&Number=143696#Post143696 Quote Link to comment
maarten. Posted August 13, 2010 Share Posted August 13, 2010 Could you test this one and see if it works for you? It works for me (VW2008 on mac). Create a Tool with this code: PROCEDURE Tool; VAR cnt : INTEGER; x,y : ARRAY[1..6] of REAL; hL : ARRAY[1..5] of HANDLE; h : HANDLE; BEGIN GetPt(x[1],y[1]); FOR cnt:=2 TO 6 DO BEGIN GetPtL(x[cnt-1],y[cnt-1],x[cnt],y[cnt]); MoveTo(x[cnt-1],y[cnt-1]); LineTo(x[cnt],y[cnt]); hL[cnt-1]:=LNewObj; ReDraw; END; FOR cnt:=1 TO 5 DO DelObject(hL[cnt]); BeginPoly; FOR cnt:=1 TO 6 DO AddPoint(x[cnt],y[cnt]); EndPoly; h:=CreateCustomObjectPath('2dpath',LNewObj,NIL); END; RUN(Tool); And create a 2d Path Pio with the name '2dpath' and this code: PROCEDURE Test; VAR objHand, recHand, wallHand, pathHand, duplHand?:HANDLE; objName?:STRING; BEGIN IF GetCustomObjectInfo(objName, objHand, recHand, wallHand) THEN BEGIN pathHand?:= GetCustomObjectPath(objHand); duplHand?:= CreateDuplicateObject(pathHand, objHand); END; END; Run(Test); Quote Link to comment
Musisback Posted August 17, 2010 Author Share Posted August 17, 2010 For a unknown reason, there is not vertical / horizontal snapping between the getpt and the first getptl. Is is the same on your machine? I m wondering if it is not some deep VW bug... Thanks for helping though, Quote Link to comment
maarten. Posted August 17, 2010 Share Posted August 17, 2010 (edited) Nope, you're right, here neither (VW2010 on Windows). Maybe i'm missing something, but why don't you use the shift button to draw with vert and hor snapping? If you would draw a locus on the first point, you could snap to it and afterwards delete it like the rest of the lines... Not really the most beautiful solution, but it might work. Edited August 17, 2010 by maarten. Quote Link to comment
Musisback Posted August 17, 2010 Author Share Posted August 17, 2010 In this, case, shift doesn't work for de vertical and horizontal snapping. At least not for the second click. Adding a locus works but then I need to "go get" the snapping point manually.... I would be great to be able tu activate the snapping point from a script... If I am bothered by such details it is because I developpe tools for a bunch a people, it is hard for them when the sofware does not work properly... Quote Link to comment
maarten. Posted August 17, 2010 Share Posted August 17, 2010 (edited) If I am bothered by such details it is because I developpe tools for a bunch a people, it is hard for them when the sofware does not work properly... I can understand this completly and you are correct, a tool needs to work properly. But again, i think i don't understand you completly. When you draw a line (for example) in VW, you can't snap to your first point either, same when you draw a polygon. By using the shift button however you can force the line to be drawn under a fixed angle. That's the way VW works and is (in my opinion ofcourse ) not such a bad way. So if i understand you correctly, you want to adjust this standard behavior so that the user don't need to use their shift button to draw lines under a fixed angle? You can change the position of the points lateron ofcourse by recalculation, or maybe if you adjust some snap options, you can also get the behavior that you want but i haven't tried it before. In this, case, shift doesn't work for de vertical and horizontal snapping. At least not for the second click. Strange, works fine here... I would be great to be able tu activate the snapping point from a script... With snapping point, do you mean the snap options? if so, you can adjust them with: Snap to Grid: SetPref(37,TRUE); Snap to Object: SetPref(38,TRUE); Snap to Edge Points: SetPref(48,TRUE); Snap to Edge Points: SetPref(48,TRUE); Snap Radius: SetPrefInt(54,90); Edited August 17, 2010 by maarten. Quote Link to comment
Musisback Posted August 18, 2010 Author Share Posted August 18, 2010 For the second click, the snapping just don't work. -Nothing appends differently if I hold the shift key for the second click. -I get not horizontal or vertical snapping either. (unlike when I use any VW made tools) -I can get the angle snapping for the second click by adding a locus like you suggested. But then I need to activate the snapping for the locus (red square) by holding the cursor on it (or pressing t) -I don't want the users to have to do that so I am wondering if it is possible to activate (red square) a snapping point (in our case the locus) from the script. I hope you anderstand better, Thanks for your ideas Quote Link to comment
maarten. Posted August 18, 2010 Share Posted August 18, 2010 Oke, that's very odd... Have you tried installing VW again? It's quite strange that it works here on several computers (PC and mac) on several versions (2008-2010). Do you have the latest SP? Does it work with the scripts i posted above? I can't think of anything else, it should work normally, very strange. Quote Link to comment
Musisback Posted August 19, 2010 Author Share Posted August 19, 2010 I also tried here on different OS (windows 7 and XP) on plenty computers. I have the SP3 but the SP4 is not available for my version yet. The scrip above did not work; There is no horizontal vertical snapping for the 2d click. Here is why I am pretty sure this is a bug: I tried running the script (and other ones of mine before) from the resource browser or as a command a then it works just fine. but when I run it as a tool (like I need it to be) then it works not ok. I get a similar bug in my tools in witch I use the getline(..) . The snapping to extension line (for the first click this time) does not work except when a run the script from as a command or from the ressource browser. About that there is something very odd: sometimes, when I have just opened the software, it work just fine for a some amont of time. But when it starts bugging, it never stops... I hope that the SP4 will correct this bug. Thanks for trying if you have any new ideas, let my know... Quote Link to comment
maarten. Posted August 19, 2010 Share Posted August 19, 2010 The scrip above did not work; There is no horizontal vertical snapping for the 2d click. I attached an image to show how it works here. If you really think it's a bug, you can always Submit a Bug (right top of this board), maybe NNA will fix it then. (btw, there's a new SP out for us, go to the Belgium site to download it, maybe that would also solve the problem?) Quote Link to comment
Musisback Posted August 19, 2010 Author Share Posted August 19, 2010 Same thing for me except between the first and second click. No snapping ... (shif hold or not) It works just fine for the other clicks. I tried the new update. it doesn't change this problem... 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.