Musisback Posted March 19, 2012 Share Posted March 19, 2012 I am unable to create and 3Drotate a 2D PIO in the same script. Procedure NewPIORect; VAR PIORect : handle; OK : boolean; BEGIN PIORect :=createcustomobjectN('PIORect', 0,0,0,FALSE); {setrot3D(PIORect ,90,0,0,0,0,0);} OK := SetEntityMatrix(PIORect ,0,0,0,90,0,0); END; run(NewPIORect); I tried booth the SetEntityMatrix function and the setrot3D. If I try to rotate it later with another script, it works fine ex: {setrot3D(LSactlayer,90,0,0,0,0,0);} message(SetEntityMatrix(LSactlayer,0,0,0,90,0,0)); Is this another bug, or am I doing something wrong? PS: -This is just an example. My PIO is complex and I really need to insert and rotate it from another script. I cannot insert it directly -I need the control points in 3D, that is why I need a 2D PIO and not A 3D PIO with 2D objects in it. Thanks Quote Link to comment
JBenghiat Posted March 19, 2012 Share Posted March 19, 2012 I think you're answering your own question -- you are rotating the 3D component of the PIO, which is empty. You can have the 2D instance in the screen plane or layer plane and have it draw in a 3D view, but you would need to orient it with a 2D rotation. You can do that right with CreateCustomObjectN. -Josh Quote Link to comment
Musisback Posted March 19, 2012 Author Share Posted March 19, 2012 I'm not sure I understand you right. I need my PIO to be created neither in the layer plane nor the screen plane but on a 3D plane. (For example the XZ plane) Do you know the code to do that? Thanks, Quote Link to comment
JBenghiat Posted March 19, 2012 Share Posted March 19, 2012 You can't have a 2D object in a 3D plane (a 2D PIO or any kind of 2D object). 2D objects show up in 3D views in the following ways: - In the layer plane (xy) - In the screen plane If you want to manipulate control points in a 3D view, say on the XZ plane, you have to align your screen plane to the XZ plane (ie front view). Alternatively, you can create a viewport of your 3D view, which will essentially project the view onto the 2D plane, and you can lay your PIO on top. If you're just trying to rotate the PIO as a workaround for control points being 2D only, as far as I know, this is not possible. -Josh Quote Link to comment
Musisback Posted March 19, 2012 Author Share Posted March 19, 2012 Actually, we now can place 2D objects on any 3D plane. That was the big step forward brought by the 2011 version of Vectorworks. However, it's seem to be bugging a little in some cases... Quote Link to comment
JBenghiat Posted March 19, 2012 Share Posted March 19, 2012 Ah, right. You're still dealing with a plane, and not a 3D object per se -- you want to look at the PlanarRef and WorkingPlane commands rather than the 3D rotation. -Josh Quote Link to comment
Musisback Posted March 20, 2012 Author Share Posted March 20, 2012 Well, in the script above, I use SetEntityMatrix VS:SetEntityMatrix Description : Sets the matrix of the plane for a planar object. If there is already a plane in the document with that matrix, the object will be set to be in that plane. Otherwise a new plane will be added to the document. FUNCTION SetEntityMatrix( objectHandle :HANDLE; offsetX :REAL; offsetY :REAL; offsetZ :REAL; rotationXAngle :REAL; rotationYAngle :REAL; rotationZAngle :REAL) : BOOLEAN; This function was made to place a planar object on a 3D plane. And it works fine EXCEPT in my case where I create AND MOVE the object (POI) in the SAME script. Does anyone know how to do it? Quote Link to comment
maarten. Posted March 20, 2012 Share Posted March 20, 2012 Did you already check if the PIORect handle isn't NIL? Message(PIORect); Quote Link to comment
Musisback Posted March 20, 2012 Author Share Posted March 20, 2012 Yes, The PIO moves, but stays in its original plane. (either screen or layer) I 've done tests with A PIO that only contain rect(0,0,100,200). It does't works... Have you tried Maarten? Does it works for you? Thanks, Quote Link to comment
maarten. Posted March 20, 2012 Share Posted March 20, 2012 I tried the following and that did work, that's why i thought your handle was NIL: Rect(0,0,10,10); IF SetEntityMatrix(LNewObj ,0,0,0,90,0,0) THEN BEGIN END; But I didn't try it with a PIO... Maybe you need to do a ResetObj(PIORect) after the SetEntityMatrix? Quote Link to comment
Musisback Posted March 20, 2012 Author Share Posted March 20, 2012 Sadly, I also tried ResetObj. It doesn't work... Quote Link to comment
JBenghiat Posted March 20, 2012 Share Posted March 20, 2012 Have you tried adding a 3D element and seeing if that rotates correctly? What I suspect is that PIOs are always treated as hybrid, even if there are only 2D elements. Have you tried having your script set a working plane, insert the object, then restore to the original view? Quote Link to comment
Musisback Posted March 20, 2012 Author Share Posted March 20, 2012 The weird think is that it works fine except during the script of creation of the PIO. It tried but it doesn't rotate because hybrid object are forbidden to rotate in 3D. It tried a 3D only PIO and it does not rotate. I tried setting a working plane by script. It really seems like it is impossible to create and rotate in a PIO from the same script... Quote Link to comment
JBenghiat Posted March 20, 2012 Share Posted March 20, 2012 Have you tried running the debugger? Perhaps the PIO geometry hasn't been crated yet when the rotate / plane assignment happens, and the debugger would show you the order. Also maybe changing the view so your desired plane matches the screen plane. Quote Link to comment
Musisback Posted March 21, 2012 Author Share Posted March 21, 2012 The PIO code is indeed run after the SetEntityMatrix function. Here is what i think happens : For more efficiency, the pio codes are run at the end and once only. This has 2 consequences : - Resetobject has not effect. - VW does not know what kind of PIO it is dealing with (3D only, hybrid or 2D only) in doubt the developers block the 3D rotations. this is something new, I just tried in VW2010 and it works fine for 3D only PIO... Well if someone can help me finding a works around, I would really appreciate it. Thanks, Quote Link to comment
maarten. Posted March 21, 2012 Share Posted March 21, 2012 Didn't test it, but what happens if you use 3 scripts? script 1: Your PIO script 2: SetEntityMatrix of the LNewObj script 3: run script 1, then script 2 Quote Link to comment
Musisback Posted March 21, 2012 Author Share Posted March 21, 2012 Well I don't know how to run a script from another script... is there a function for that? Anyway my script is actually a tool that involves clicks, but it would worth a try... Quote Link to comment
maarten. Posted March 21, 2012 Share Posted March 21, 2012 ah, yes, that isn't possible in VS... Have you tried Joshua's suggestion to change the plane with SetViewMatrix() and then place the PIO? Quote Link to comment
Musisback Posted March 21, 2012 Author Share Posted March 21, 2012 Yep, it doesn't work. I am pretty sure it is a bug... Quote Link to comment
Miguel Barrera Posted March 21, 2012 Share Posted March 21, 2012 You can execute different code in the same pio by sending messages. The workflow can be something like the following: 1. Check messages. if no message (0) then do function 1. 2. Change messages to do function 2 if needed and reset object 3. Check messages, if message (1), do function 2. 4. Change messages back to no message (0). But more importantly, I am lost as to what are you trying to do. Place a 2D pio on a 3D plane? Pio's behave similar to symbols and for hybrids, the normal way is to place them on the top 2D view so that when you change to a 3D view, the 3D objects will be shown. The pio will execute both the 2D & 3D object creation in the same reset event but will only show the 2D objects on the top plan view and the 3D objects on all other views. We might be able to help further if we knew what the pio is suppose to do. Quote Link to comment
Musisback Posted March 22, 2012 Author Share Posted March 22, 2012 Sorry, but I don't understand at all what you mean with the messages. My pio is a kind of 3D (vertical) associate dimension. It's position and place are depending of other of my PIO's. I need the PIO to be 2D because I need the control points to be available in a vertical plane. (to change the shape of the dimension) I use a other tool to create the PIO and define on which objects the "associate dimension PIO" must be locked. Vectorscript seem to be unable to create and move on a vertical plane the 2D PIO in the same script. (my insertion tool) 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.