trevorgooch Posted July 9, 2024 Share Posted July 9, 2024 Hi! I would like to make a script that creates a new “red” plug in symbol ufrom the selected plug in object. My hope is to automate and collect some of the non-styled plug in objects (light lighting devices) at the end of a show, to re-use in the future. I can find an examples and commands for symbols, but I’m struggling to get started with plug in objects. If I can get a nudge in the right direction, it would be a huge help. Quote Link to comment
Pat Stanford Posted July 9, 2024 Share Posted July 9, 2024 A "Red" plugin is just a symbol that contains a single Plugin Object. When you insert that symbol, rather than inserting it as a symbol, it inserts it and then ungroups (or equivalent) so that the PIO is what appears in the drawing. SetObjectVariableBoolean(FSymDef,127,True); Will set the First Symbol Definition in the resource browser to be a "Red" symbol. But I have not figured out a good way to actually get the name of the symbol to change colors. The best I have found is to look at the resources in the file from a different file. Or edit the Edit the symbol Definition and just click OK. Change the FSymDef to whatever code you need to identify your PIO converted to a symbol. HTH 1 Quote Link to comment
Jesse Cogswell Posted July 9, 2024 Share Posted July 9, 2024 To get the text to change to red, you have to update the Resource Thumbnail using UpdateThumbnailPreview(FSymDef). It is a Function that returns a boolean, so if you're trying to keep the script super simple without variables, you can use IF(UpdateThumbnailPreview(FSymDef))) THEN SysBeep; 2 Quote Link to comment
Pat Stanford Posted July 10, 2024 Share Posted July 10, 2024 Thank you Jesse. Too many functions to know/remember them all any more. 😉 Quote Link to comment
Jesse Cogswell Posted July 10, 2024 Share Posted July 10, 2024 Okay, so super rough script hammered out that will do what you want. The script will prompt you to name the new symbol, and if the symbol name is valid and the first selected object of the active layer is a PIO, it will create a "red" symbol version of it in its current rotation. Let me know if you would rather reset the rotation to 0 and I'll tell you what to change. It should work with 2D, 3D, and hybrid PIOs. Let me know if you have any questions or if anything breaks. PROCEDURE SavePluginToRedSymbol; {* Stores selected PIO object as "red" Symbol Developed by: Jesse Cogswell Date: 7/9/2024 Revisions: *} CONST kPIO = 86; kInsertAsGroup = 127; kScreenPlane = 1160; VAR symHd,pioHd,tempHd:HANDLE; symName:STRING; nameCheck,BSB:BOOLEAN; loc,rot:POINT3D; BEGIN nameCheck:=FALSE; symName:=''; IF(GetTypeN(FSActLayer) = kPIO) THEN pioHd:=FSActLayer; WHILE(NOT nameCheck) DO BEGIN symName:=StrDialog('Enter Symbol Name',''); IF(GetObject(symName) = NIL) THEN nameCheck:=TRUE ELSE BEGIN AlrtDialog('That name is in use, please enter a new one'); nameCheck:=FALSE; END; END; IF((nameCheck) & (pioHd <> NIL)) THEN BEGIN BeginSym(symName); Locus(0,0); tempHd:=LNewObj; EndSym; symHd:=GetObject(symName); pioHd:=CreateDuplicateObject(pioHd,NIL); IF(GetEntityMatrix(pioHd,loc.x,loc.y,loc.z,rot.x,rot.y,rot.z)) THEN BSB:=SetEntityMatrix(pioHd,0,0,0,rot.x,rot.y,rot.z); IF(SetParent(pioHd,symHd)) THEN DelObject(tempHd); SetObjectVariableBoolean(pioHd,kScreenPlane,TRUE); SetObjectVariableBoolean(symHd,kInsertAsGroup,TRUE); IF(UpdateThumbnailPreview(symHd)) THEN SysBeep; END; END; Run(SavePluginToRedSymbol); 1 Quote Link to comment
trevorgooch Posted July 10, 2024 Author Share Posted July 10, 2024 @Pat Stanford @Jesse Cogswell - Thanks so much for replying! Jesse, this is very very helpful, and is exactly what I asked for! Also, way more that a point in the right direction! I have broader aspirations for this, and will either share the results, or politely ask for more guidance. Thanks again! -TG 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.