Jump to content
Developer Wiki and Function Reference Links ×

Limited number verticles in a 2D path PIO


Recommended Posts

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 by maarten.
Link to comment

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

Link to comment

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);

Link to comment

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 by maarten.
Link to comment

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

Link to comment
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 by maarten.
Link to comment

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

Link to comment

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.

Link to comment

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

Link to comment
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?)

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