Jump to content

Fuge

Member
  • Posts

    158
  • Joined

  • Last visited

Everything posted by Fuge

  1. See this this function... https://developer.vectorworks.net/index.php?title=VS:Round HTH
  2. Thanks for the direction Pat... Did a quick test... this does what I was looking for... The design layer is always the same in our template.. So this works.... Posted for others... ----------------------- PROCEDURE VPView; VAR offsetX,offsetY,offsetZ :REAL; rotationXAng,rotationYAng,rotationZAng: REAL; result: BOOLEAN; objectHandle,LayerHandle :HANDLE; BEGIN objectHandle:= LSActLayer; { Selected Viewport } result:= GetViewMatrix( objectHandle, offsetX,offsetY,offsetZ, rotationXAng, rotationYAng, rotationZAng ); { Get the viewport matrix } Layer('Design Layer-1'); { Go to the Layer design layer with the 3d model } SetView( rotationXAng, rotationYAng, rotationZAng, offsetX,offsetY,offsetZ); { Set the view with the ViewMatrix variables from the viewport } VSave('The View'); { Save the view } END; Run(VPView);
  3. Hey Fellas... Has anyone figured out how to get the camera view of a viewport and save it as a saved view with a script? Steps to script.. I was thinking we're. 1. ActLayerName:=GetLName(ActLayer); { Set the active layer name as a string } 2. Edit Camera of selected Viewport.. - This is where I don't see a solution. Get the View of the Camera View - GetVPGroup() Nothing for Camera... or any other hook.. Need some way to navigate to the Design Layer with the view of the viewport. Some way to Edit Camera > Save The View > Return To Viewport... 3. Save View VSave('Test VP View'); 4. Return to the Layer(ActLayerName); Any insight is appreciated... There's always something you're not aware of.. 😆 Thanks! Dave
  4. 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
  5. Just a hunch... but are you using an older workspace from a previous version? That could be the problem possibly..
  6. Try something like this... I do this stuff all the time... Hopefully that helps. SetPenColorByClass (Lnewobj ); SetClass ( Lnewobj , 'YourclassName' ); SetTextureRefN( Lnewobj, -1, 3, 0);
  7. 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
  8. 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
  9. That seems very odd... I think you'll need to do a re-installed...
  10. Hi Trevor, Why don't you just use =COUNT in a database row cell?
  11. 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
  12. 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...
  13. 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...
  14. 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 );
  15. 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
  16. Hey Thanks @JustinH that works 👍 and helps connect the dots... Much appreciated...
  17. 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.
  18. Much appreciated @JBenghiat I'll report my findings.... 🤠 thanks for passing this along....
  19. 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);
  20. 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);
  21. 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
  22. That works great- thanks Pat... Dave
  23. 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
  24. 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... 😵
  25. Ahh.. Okay... Thank you for the reply! I'll give that a try... good to know.. Dave
×
×
  • Create New...