Sam Jones Posted March 5, 2021 Share Posted March 5, 2021 I'm trying to copy a symbol from a file in one of the VW libraries, but failing miserably. Code below. PROCEDURE AttachAccessory; {$DEBUG} (* 'Light Acc Iris' 'Light Acc 6.25in Short Top Hat' *) CONST kcr = chr(13); VAR TheLight :HANDLE; TheAcc :HANDLE; AccIndex :LONGINT; PosX, PosY :REAL; PosRot :REAL; Rot3DX :REAL; Rot3DY :REAL; Rot3DZ :REAL; Pos3DX :REAL; Pos3DY :REAL; Pos3DZ :REAL; VWAccFile :STRING; OK :BOOLEAN; BEGIN TheAcc := NIL; OK := TRUE; {I HAVE TRIED EACH OF THE PATHWAYS BELOW. I'm obviously missing something} (*VWAccFile := CONCAT('Macintosh HD', GetFolderPath(13),'Plug-ins/Objects - Ent Lighting Accessories/Accessories Generic.vwx');*) (*VWAccFile := CONCAT(GetFolderPath(13),'Plug-ins/Objects - Ent Lighting Accessories/Accessories Generic.vwx');*) VWAccFile := 'Plug-ins/Objects - Ent Lighting Accessories/Accessories Generic.vwx'; (*VWAccFile := CONCAT('Macintosh HD', GetFolderPath(13),'Plug-ins\Objects - Ent Lighting Accessories\Accessories Generic.vwx');*) (*VWAccFile := CONCAT(GetFolderPath(13),'Plug-ins\Objects - Ent Lighting Accessories\Accessories Generic.vwx');*) (*VWAccFile := 'Plug-ins\Objects - Ent Lighting Accessories\Accessories Generic.vwx';*) AlrtDialog(concat('VWAccFile = ', VWAccFile)); TheAcc := GetObject('Light Acc 6.25in Short Top Hat'); IF TheAcc = NIL THEN BEGIN OK := CopySymbol(VWAccFile, 'Light Acc 6.25in Short Top Hat'); IF OK THEN BEGIN AlrtDialog('Copy MADE'); Symbol('Light Acc 6.25in Short Top Hat', 0, 0, 0); END ELSE AlrtDialog('Copy FAILED'); END ELSE BEGIN AlrtDialog('Symbol in Document'); Symbol('Light Acc 6.25in Short Top Hat', 0, 0, 0); END; REDRAWALL; END; RUN(AttachAccessory); Quote Link to comment
JBenghiat Posted March 5, 2021 Share Posted March 5, 2021 Well, you're adding in "Plug-ins" after the folder path… 🙂 You can just use GetFolderPath(189), and avoid having to deal with getting the OS path separator. You shouldn't need to concatenate anything in front of it. Quote Link to comment
Sam Jones Posted March 5, 2021 Author Share Posted March 5, 2021 If I concatenate the file name to the end of the result of GetFolderPath(189), it all works great. So... is there a list of constants for the folders in the application library? Quote Link to comment
JBenghiat Posted March 5, 2021 Share Posted March 5, 2021 It’s right in the documentation https://developer.vectorworks.net/index.php/VS:GetFolderPath A handful of additional paths may be in the SDK Quote Link to comment
Sam Jones Posted March 5, 2021 Author Share Posted March 5, 2021 It can be somewhat embarrassing that the writers of the documentation expect me to read past 10 to 15 lines to take advantage of the documentation. 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.