Jump to content

Hello Community!

We will perform a system update on the Vectorworks Community Board on Friday, Dec 8th, from 3.00 PM to 6.00 PM EST. During this time, the site will be unavailable. I appreciate your patience.

Fuge

Member
  • Posts

    155
  • Joined

  • Last visited

Everything posted by Fuge

  1. Hey KingChaos, See the attached... The attached is saved back to VW22... But not tested there... HTH .. A lot more development is being worked on for this... Something I'll post in the future.. Procedure Taggit; VAR viewportHandle,VPGroupH, VPObject:HANDLE; VPName:STRING; ObjName:STRING; PROCEDURE TagObj(H:HANDLE); CONST TagName = 'Code Tag'; LeaderAbove = 250mm; LeaderRight = 100mm; KVerticalOffset = 100mm; VAR DataTagH,ObjectH,VPObject :HANDLE; StyleBoo, TagBoo,AnnoBoo :Boolean; TagX, TagY,x1,y1,x2,y2, pX, pY:REAL; ObjectTop, ObjectTopInSpace, ObjectCenter, ObjectCenterInSpace, LeaderX, LeaderY :REAL; BEGIN GetBBox(H,x1,y1,x2,y2); ObjectTop:=y2; ObjectTopInSpace:= (y1); ObjectCenter:= (x2-x1)/2; ObjectCenterInSpace:= ((x2-x1) + x1) - ((x2-x1)/2); DataTagH := CreateCustomObjectN('Data Tag', 0 ,0 ,0, False); StyleBoo := SetPluginStyle(DataTagH,TagName); TagBoo := DT_AssociateWithObj(DataTagH,H); AnnoBoo:= AddVPAnnotationObject( viewportHandle, DataTagH); DataTagH:= Lnewobj; LeaderY:= ObjectTopInSpace+LeaderAbove; LeaderX:= ObjectCenterInSpace+LeaderRight; HMove(DataTagH, LeaderX, LeaderY ); {Leader above center of object } SetRField(DataTagH,'Data Tag','__RefOffsetX',Num2StrF(Round(ObjectCenter))); { Move horizontal } SetRField(DataTagH,'Data Tag','__RefOffsetY',Num2StrF((ObjectTopInSpace-KVerticalOffset))); { Moves vertical } SetRField(DataTagH,'Data Tag','Horizontal Position','Right'); { Default side the leader is placed } SetRField(DataTagH,'Data Tag','World-based','False'); ResetObject(DataTagH); END; BEGIN Layer('View-1'); { Example Go to the layer you want by its name } ViewportHandle := GetObject('MyViewPort'); { Example - Get the Viewport you want be name, giving you a handle to it } If ViewportHandle=NIL THEN BEGIN AlrtDialog('Select a viewport!'); Sysbeep; END ELSE BEGIN VPGroupH:= GetVPGroup( viewportHandle,2); VPObject := FInGroup(VPGroupH); { The record criteria, class, etc to tag } ForEachObject(TagObj,((R IN ['Nimlok DB']) &(C='STEP-1') & (T<>LIGHT))); VPObject := NextObj(VPObject); UpdateVP( ViewportHandle); Redrawall; END; END; Run(Taggit); AutoDataTag_v2022.vwx
  2. Just a hunch... but are you using an older workspace from a previous version? That could be the problem possibly..
  3. Try something like this... I do this stuff all the time... Hopefully that helps. SetPenColorByClass (Lnewobj ); SetClass ( Lnewobj , 'YourclassName' ); SetTextureRefN( Lnewobj, -1, 3, 0);
  4. Okay... I should of realized that Data Tag is a pio. Knowing that here is the concept and example. Hopefully useful to others... I plan to tweak this further, but it shows it can be done. See the attached file as well, the procedure is on a script palette with a VP to look at.. Thanks Dave Procedure Taggit; VAR viewportHandle,VPGroupH, VPObject:HANDLE; VPName:STRING; ObjName:STRING; PROCEDURE TagObj(H:HANDLE); CONST TagName = 'Code Tag'; LeaderAbove = 250mm; LeaderRight = 100mm; KVerticalOffset = 100mm; VAR DataTagH,ObjectH,VPObject :HANDLE; StyleBoo, TagBoo,AnnoBoo :Boolean; TagX, TagY,x1,y1,x2,y2, pX, pY:REAL; ObjectTop, ObjectTopInSpace, ObjectCenter, ObjectCenterInSpace, LeaderX, LeaderY :REAL; BEGIN GetBBox(H,x1,y1,x2,y2); ObjectTop:=y2; ObjectTopInSpace:= (y1); ObjectCenter:= (x2-x1)/2; ObjectCenterInSpace:= ((x2-x1) + x1) - ((x2-x1)/2); DataTagH := CreateCustomObjectN('Data Tag', 0 ,0 ,0, False); StyleBoo := SetPluginStyle(DataTagH,TagName); TagBoo := DT_AssociateWithObj(DataTagH,H); AnnoBoo:= AddVPAnnotationObject( viewportHandle, DataTagH); DataTagH:= Lnewobj; LeaderY:= ObjectTopInSpace+LeaderAbove; LeaderX:= ObjectCenterInSpace+LeaderRight; HMove(DataTagH, LeaderX, LeaderY ); {Leader above center of object } SetRField(DataTagH,'Data Tag','__RefOffsetX',Num2StrF(Round(ObjectCenter))); { Move horizontal } SetRField(DataTagH,'Data Tag','__RefOffsetY',Num2StrF((ObjectTopInSpace-KVerticalOffset))); { Moves vertical } SetRField(DataTagH,'Data Tag','Horizontal Position','Right'); { Default side the leader is placed } SetRField(DataTagH,'Data Tag','World-based','False'); ResetObject(DataTagH); END; BEGIN ViewportHandle := LSActLayer; If ViewportHandle=NIL THEN BEGIN AlrtDialog('Select a viewport!'); Sysbeep; END ELSE BEGIN VPGroupH:= GetVPGroup( viewportHandle,2); VPObject := FInGroup(VPGroupH); { The record criteria, class, etc to tag } ForEachObject(TagObj,((R IN ['Nimlok DB']) &(C='STEP-1') & (T<>LIGHT))); VPObject := NextObj(VPObject); UpdateVP( ViewportHandle); Redrawall; END; END; Run(Taggit); AutoDataTag.vwx
  5. Hey Guys... Here I am again looking for something that's probably not doable.. But I'm throwing it out there... either I'm not seeing a way to do it, or can't find the functions to data tag an object. What I'm thinking.... 1. Select a viewport. 2. Run the script..... 3. All objects within the selected viewport, assigned to a particular class, are automatically data tagged... *** when you have a bunch of viewports and everything in each needs a tag this would be a monster time saver *** Any insight.. ideas... is appreciated... Thanks Dave
  6. That seems very odd... I think you'll need to do a re-installed...
  7. Hi Trevor, Why don't you just use =COUNT in a database row cell?
  8. Hello- Yeah like most files, plugins are not backward compatible. As you're seeing, VW 2021 won't recognize the edited plugin file from 2023. The best you can do is keep the plugin file native to each version and create your scripts in an include file and use calls that work in the older version, but you'll still have to keep both plugin files up to date. Or only create your plugins in the older version, but use them in both versions of VWs. HTH
  9. Hi Juan @JuanP There was a person looking for the examples again today... and the download links are still broken... I've reported this twice... in the last few months and they're still not fixed...
  10. There's some examples of PIOs on this page... http://web.archive.org/web/20210413010835/https://www.vectorworks.net/support/custom/vscript/example Same as what's on the developer site, but those links are still broken...
  11. If I follow you correctly... you should be able to do what you want. From the menu command you'll need to tell the PIO what to do... something like... { Your Plugin Object for Title Block } MyTitleBlockHhandle := CreateCustomObject('Your title Block Plugin Object',0,0,0); SetRField(MyTitleBlockHhandle,'Show date', TheDate,'x/xx/xxxx'); SetRField(MyTitleBlockHhandle,'Start date', ThestartDate,'x/xx/xxxx'); HMove(MyTitleBlockHhandle, xOffset, yOffset ); HRotate(MyTitleBlockHhandle, centerX,centerY,rotationAngle );
  12. Looking for freelance designer with some experience in the exhibit industry to do some assemblies from a provided Vectorworks library using our components. Must be proficient on Vectorworks, be using Vectorworks 2023 Design Suite, and have a dropbox account. Please send me a private message with your experience and hourly rate etc... Thanks Dave
  13. Hey Thanks @JustinH that works 👍 and helps connect the dots... Much appreciated...
  14. Well after going down the rabbit 🐇 hole on this one .. I can't say I've made much progress on it. Some of the additional Selectors work, for example 1278 for ovRenderStyleEmitterBrightness, however nothing works for setting Indirect Lighting with any combination of selectors as Josh suggested. I then thought... Hmm what if I set a Render Style for the Background Render that best matches Shaded since it would have it's Lighting preset under Lighting Options for the Viewport. If you do a GET for it, when a Render Style is chosen it returns 15, however if you do a SET with 15, it sets it to Custom Renderworks instead 😆. Of course there doesn't seem to be a way to select which Render style you'd want anyhow, from what I can discern. I'd only have one in this particular template file. So for the time being it appears to be a no go. Hopefully in the future there will be a bit more clarity and object sectors for this. In my case.. it would really be helpful for automating assembly instructions.
  15. Much appreciated @JBenghiat I'll report my findings.... 🤠 thanks for passing this along....
  16. Hey Ray - @MullinRJ, Thanks for spending so much time on this, much appreciated. At least I got 50% of what I was hoping figured out 😜 Yeah, I think you're correct, If you can GET it.. you should be able to SET it... Quick summary and test script below... if helpful to anyone else.. and for later reference.. Have a great day! Dave Procedure SetSelectedVPLighting; CONST KIndirectLightIndex = 3; { 0, 5, 1, 2, 3 - For type in order } KAmbInfoONOFF = TRUE; { Boolean True/False } KAmbInfoBrightNess = 0.85; { Number in decimal for percentage } KAmbOcclusionONOFF = TRUE; { Boolean True/False } KAmbOcclusionStrength = 0.50; { Number in decimal for percentage } KAmbOcclusionSize = 100; { Real Number for size } VAR viewportHandle :HANDLE; BEGIN viewportHandle := LSActLayer; { Last selected object , Select a viewport } SetObjectVariableLongInt(viewportHandle,1269,KIndirectLightIndex); { Bug - runs but doesn't set - Indirect Lighting Index, 0, 5, 1, 2, 3 } SetObjectVariableBoolean(viewportHandle,1014,KAmbInfoONOFF); { Ambient Info On/Off } SetObjectVariableReal(viewportHandle,1015,KAmbInfoBrightNess); { Ambient Info Brightness } SetObjectVariableBoolean(viewportHandle,1302,KAmbOcclusionONOFF ); { Ambient Occlusion } { SetObjectVariableReal(viewportHandle,1303,KAmbOcclusionStrength); { Broken - fails - Ambient Occlusion Strength % } { SetObjectVariableReal(viewportHandle,1304,KAmbOcclusionSize); { Broken - fails - Ambient Occlusion Size } END; Run (SetSelectedVPLighting);
  17. Here's a quick example to show how it could work.. Cheer! PROCEDURE TextExample; CONST TEXTANGLE = 90; { Set the text degrees here } VAR TXTHandle:HANDLE; BOO :BOOLEAN; BEGIN TextOrigin(0,0); BeginText; 'TEST' EndText; TXTHandle:=Lnewobj; BOO:= SetEntityMatrix(TXTHandle, 0,0,0,TEXTANGLE,0,0); END; RUN(TextExample);
  18. Hey Guys... I don't see Object selectors for a viewport's Indirect Light and Ambient occlusion.. on the developer site.. but I know.. that doesn't always mean it doesn't exist 🤭 Anyone figure out, or know of undocumented selectors or some other means of setting these two? TIA... Dave
  19. That works great- thanks Pat... Dave
  20. Hi Guys... First, thanks in advance for the help. Has anyone figured out how to set a worksheet cell to the files name? There doesn't appear to be a function for worksheets... You'd think there'd be something simple like... = GetFName as in VS. I'm sure I can figure out something by scripting something to create an Object in the document to read. Cheers! Dave
  21. Thanks Larry... Yeah, I'm finding this easier said than done... I wish NNA had some examples to study.. I'm still trying to figure it out... 😵
  22. Ahh.. Okay... Thank you for the reply! I'll give that a try... good to know.. Dave
  23. Fuge

    RunImageComp

    Thanks Pat.... 👍
  24. Curious if someone can confirm what I'm seeing with the following script. Below.. I'm wanting to select an object and make it a child of a PIO. It appear from the testing I've done that the PIO has to already exist, or exist on the layer, before it can be made the parent. It appears the PIO can't created during the script, and isn't realized yet... for CreateDuplicateObject to work. If the PIO already exists on the layer and selected with the other object to be made the child, CreateDuplicate works fine.. Maybe I'm missing something... but I'm wondering how I can make this work if the PIO isn't already on the layer prior to running the script. What's a workaround or another approach? Should the PIO be made a symbol.. Would making it into a symbol, and inserting the symbol during run behave different since I wouldn't be "creating" it since it would already exist?! Thanks!! PROCEDURE SetParent; VAR h1, h2, hPIO, DupObjh: HANDLE; ObjName :STRING; BEGIN { Select an object, run, script adds the PIO, Does not work 😞 } ObjName:= 'TESTPIO'; h1 := FSActLayer; hPIO := CreateCustomObject( ObjName ,0,0,0) ; SetSelect( hPIO ); DupObjh := CreateDuplicateObject( hPIO, h1 ); { Sub this... On the active layer, select an object, then select the PIO, run, works } { h1 := FSActLayer; h2 := NextSObj(h1); DupObjh := CreateDuplicateObject(h2, h1); } END; RUN(SetParent);
  25. Fuge

    RunImageComp

    Thanks Josh... I did further Scooby-doo-ing around but didn't find anything about bitmap interface... It doesn't appear to be very well documented. Appreciate your time... Dave
×
×
  • Create New...