Sam Jones Posted March 5, 2021 Share Posted March 5, 2021 When one uses the Accessory Insertion tool to place an iris on a Source 4 Lighting Device, the iris gets placed at the front of the light. The following code should move the iris (the only accessory) to the gate position on the S4 Lighting Device. Instead, nothing happens. I'm missing something yet again. PROCEDURE MoveAccessory; {$DEBUG} CONST kcr = chr(13); VAR TheLight :HANDLE; TheAcc :HANDLE; AccNumber :LONGINT; AccIndex :LONGINT; PosX, PosY :REAL; PosRot :REAL; Rot3DX :REAL; Rot3DY :REAL; Rot3DZ :REAL; Pos3DX :REAL; Pos3DY :REAL; Pos3DZ :REAL; VWAccFile :STRING; Index :INTEGER; OK :BOOLEAN; BEGIN TheLight := FSActLayer; AccNumber := LDevice_GetAccCount(TheLight, 0); IF AccNumber > 0 THEN BEGIN AccIndex := 0; LDevice_GetAccPos2D(TheLight, 0, AccIndex, PosX, PosY, PosRot); LDevice_GetAccPos3D(TheLight, 0, AccIndex, Rot3DX, Rot3DY, Rot3DZ, Pos3DX, Pos3DY, Pos3DZ); PosY := 4.01; Pos3DZ := -16.08; LDevice_SetAccPos2D(TheLight, 0, AccIndex, PosX, PosY, PosRot); LDevice_SetAccPos3D(TheLight, 0, AccIndex, Rot3DX, Rot3DY, Rot3DZ, Pos3DX, Pos3DY, Pos3DZ); ResetObject(TheLight); END; END; RUN(MoveAccessory); Quote Link to comment
Pat Stanford Posted March 6, 2021 Share Posted March 6, 2021 You set AccIndex to zero then use that for all your other functions. Are you sure the GetAccPos functions are zero based? If they are 1 based then that is your problem. Quote Link to comment
Sam Jones Posted March 6, 2021 Author Share Posted March 6, 2021 Values 0, 1, and 2 for AccIndex all create no change. Quote Link to comment
Pat Stanford Posted March 6, 2021 Share Posted March 6, 2021 What value is AccNumber returning? Do you actually have an accessory (that VW knows is an accessory) attached or is it returning zero and the get/set block is never running? After that I'm out. You will have to wait for Josh ;-) Quote Link to comment
Sam Jones Posted March 6, 2021 Author Share Posted March 6, 2021 I placed the accessory which from then on behaves like it was placed, so I know there is one accessory to be moved. I did check the AccNumber variable anyway, and it is yielding a 1. So, why doesn't the accessory move? @klinzey ? @JBenghiat ? Quote Link to comment
JBenghiat Posted March 7, 2021 Share Posted March 7, 2021 I don’t see anything fundamentally wrong, though so far I’ve only worked with getting the coordinates. My only thought is to check to see if coordinates are in mm. Quote Link to comment
Sam Jones Posted March 7, 2021 Author Share Posted March 7, 2021 I will check on the units, but I would think that the accessory would move regardless of the units just not the expected amount; the accessory does not move at all. Quote Link to comment
LarryO Posted March 10, 2021 Share Posted March 10, 2021 If the accessory is already at the absolute position 4.01 (and -16.08) it would not be moving anywhere new. Display PosY before assigning it 4.01. Quote Link to comment
Sam Jones Posted March 11, 2021 Author Share Posted March 11, 2021 I don't know what you mean by "absolute position" , but PosY displays 0. I assign it 4.01, and it does not move. I assign it -4.01, and it does not move. The fact that it displays 0 is, in and of itself, suspicious. A 0 value should be the insertion point of the fixture, or so I thought, but the accessory is at the front of the light. All sorts of stuff here seems to be just wrong. I hope it can be either explained or fixed, preferably both. Quote Link to comment
Guest Yordan Kostadinov Posted March 11, 2021 Share Posted March 11, 2021 Hi @Sam Jones, I can confirm there's an issue with both LDevice_SetAccPos2D and 3D, they do not currently work. This will be fixed in the upcoming SP3. Also, for LDevice_Get/SetAccPos3D, first are the position parameters, then the rotation, in your example they are swapped. (Edit - I saw it was wrong in the help too, so I corrected it). Also, a minor change in behavior of LDevice_GetAccPos2D and 3D occurs in SP3 - it will return the location where the accessory is rendered (in neutral position, focusing is handled by the lighting device internally), because in SP2 it returned location values only if its position is customized, but not if in default position. Also, as of SP3 Vectorworks supports Body accessories. Attach the Parts record with Body checked to the accessory symbol, and it will be positioned on the insertion point in 2D and the rotation center in 3D, not the front. Thanks for reporting the problem and let me know if you have more questions. Yordan Quote Link to comment
Sam Jones Posted March 11, 2021 Author Share Posted March 11, 2021 Yordan, Thank you. I am looking forward to the SP3 fixes and additions. I think what you described will work well as long as we can successfully reposition accessories as needed with VS. Checking the Body in the Parts record is an interesting and useful addition. There will be other accessories that are custom that I will need to reposition, but that should be my issue not VW's. For example, some users may wish to have stirrups attached to Fixtures and Static Accessories, but their default placement may vary from user to user, hence my need for the VS placement calls. Thanks again, and I'm looking forward to getting this all rung out. Quote Link to comment
LarryO Posted March 13, 2021 Share Posted March 13, 2021 "Absolute positioning" is the method you appeared to be using to reset the accessory's location. Your code was setting it to a coordinate location rather than directing it some distance from wherever it was currently located. The latter being referred to as "relative positioning". Quote Link to comment
Sam Jones Posted March 22, 2021 Author Share Posted March 22, 2021 On 3/11/2021 at 12:08 PM, Yordan Kostadinov said: I can confirm there's an issue with both LDevice_SetAccPos2D and 3D, they do not currently work. This will be fixed in the upcoming SP3. In SP3, build 587753, the code below, which incorporates your correction, does not move the iris that has been placed at the front of the light by Lighting Accessory tool. Am I doing something wrong, or did the fix not get into SP3? PROCEDURE MoveAccessory; {DEBUG} CONST kcr = chr(13); VAR TheLight :HANDLE; TheAcc :HANDLE; AccNumber :LONGINT; AccIndex :LONGINT; PosX, PosY :REAL; PosRot :REAL; Rot3DX :REAL; Rot3DY :REAL; Rot3DZ :REAL; Pos3DX :REAL; Pos3DY :REAL; Pos3DZ :REAL; VWAccFile :STRING; Index :INTEGER; OK :BOOLEAN; BEGIN TheLight := FSActLayer; AccNumber := LDevice_GetAccCount(TheLight, 0); IF AccNumber > 0 THEN BEGIN AccIndex := 1; LDevice_GetAccPos2D(TheLight, 0, AccIndex, PosX, PosY, PosRot); LDevice_GetAccPos3D(TheLight, 0, AccIndex, Pos3DX, Pos3DY, Pos3DZ, Rot3DX, Rot3DY, Rot3DZ); AlrtDialog(CONCAT('PosY = ', PosY, kcr, 'Pos3DZ = ', Pos3DZ)); PosY := -4.01; Pos3DZ := -16.08; LDevice_SetAccPos2D(TheLight, 0, AccIndex, PosX, PosY, PosRot); LDevice_SetAccPos3D(TheLight, 0, AccIndex, Pos3DX, Pos3DY, Pos3DZ, Rot3DX, Rot3DY, Rot3DZ); ResetObject(TheLight); END; {IF AccNumber > 0 } END; RUN(MoveAccessory) Quote Link to comment
Guest Yordan Kostadinov Posted March 22, 2021 Share Posted March 22, 2021 Hi @Sam Jones, I see only one problem with this code: 6 hours ago, Sam Jones said: AccIndex := 1; Note that the new functions uses 0 based indexing, the script will work as expected with AccIndex := 0; Let me know if you have further problems. Regards, Yordan Quote Link to comment
Sam Jones Posted March 23, 2021 Author Share Posted March 23, 2021 The new functions seem to work well. The next question is how can I retrieve the names of the accessory symbols being used? LDevice_GetParamStr() seems to require a string (universal name) to get a string. I would like to retrieve the name of the symbol being used at a specified accessory index. Thx Quote Link to comment
Vectorworks, Inc Employee klinzey Posted March 24, 2021 Vectorworks, Inc Employee Share Posted March 24, 2021 The UniversalName required by the function is the Universal Parameter name field, in this case "Symbol Name". We use the same filed names as the lighting device for accessories and cells. SymbolName := LDevice_GetParamStr(handle, cellIndex, accessoryIndex, 'Symbol Name') Quote Link to comment
Sam Jones Posted March 24, 2021 Author Share Posted March 24, 2021 Cool. Seems obvious now. Kevin and Yordan, Despite what seemed to be some hiccups during the beta period, I think the Accessory implementation is very good. I haven't played with multiple cells yet, so that may be an issue, but both the functions available to the user and to VS seem to work well. I have only one or two tools that I think are necessary for me to make. The VW UI for accessory editing is a little arcane, but once figured out, it is simple and fairly efficient, much better than the old way. Some caviats: I haven't checked the interaction with LW, I haven't used the Instrument Summary yet, and I haven't worked with multiple cells. Those three scare me a bit, but still, good job. 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.