Elite Exhibits Posted February 13, 2023 Share Posted February 13, 2023 Question Script to convert ALL extrudes in a drawing to Generic Solids. Many Symbols - Created from many basic symbols - Each basic component of these symbol is an extrude. Need to convert them to Generic Solids to export to Form-Z a script to convert all extrudes would be great. As a second thought, I have a simple worksheet to list Extrudes - Where they are is a key to converting them if the process is only by hand . The function =IMAGE shows me what they look like, a good start. The name of the symbol they are in would be good. ie: =SYMBOLNAME (criteria) what would the criteria be ? Suggestions are always appreciated Peter Quote Link to comment
Pat Stanford Posted February 13, 2023 Share Posted February 13, 2023 Since you already have the worksheet showing the images, you should be able to add an additional column with a formula of just: =SymbolName and it should report the name of the symbol in every subrow of the database. Are the symbols just the single Extrude (or any similar Boolean Solid object (Extrude, Solid Addition, Solid Subtraction, etc.)? Or are the symbols more complicated having different types of objects? Are the symbols nested? Meaning do you have a symbol inside another symbol? Are these simple 3D symbols or Hybrid Symbols? Does this need to be done in the original file and keep all the original symbol definitions? Or could you do this on a copy of the file where we edit the symbol definitions to contain only generic solids and then Convert to Group to get rid of the "symbolness" of the objects? As is my usual plea, more information about what you are actually tryin to accomplish and where you are starting from so we can offer better options. Quote Link to comment
Elite Exhibits Posted February 13, 2023 Author Share Posted February 13, 2023 Pat =SymbolName does not fill the cell for me. Main Symbol is composed of multiple base symbols. Each base symbol is an Extrude (example attached) I copy sets of these symbols to a new file and convert them there - keeping the originals in the original file. At this point I have not converted the Main Symbol into a group, nor the base symbols. I only convert the Extrudes to Generic Solids. (Still testing with the Form-Z people) I edit the base Symbols in the Resource Manager where I am able to edit a symbol, then select and edit the next without exiting the first symbol edit. I refresh the Worksheet to see if there are any Symbols left in the current set. (FYI:There are 1898 potential Main Symbols in the original file.) (VW 2020 - MacBook Pro) Peter Extrude Count.vwx Quote Link to comment
MullinRJ Posted February 13, 2023 Share Posted February 13, 2023 Hello Peter, Try this script – but only on copies of your files before you are sure it does what you want. This will convert ALL Extrudes in your Symbol Definition Library to Generic Solids. PROCEDURE Extr2Solids; { Convert all Extrudes in symbol library to Generic Solids. } { VERY LIGHTLY TESTED - BACKUP WORK BEFORE USING, and USE ON A COPY FIRST. } { 13 Feb 2023 - R. Mullin } function ConvertIt(H :Handle) :Boolean; Var OT :Integer; Begin OT := GetTypeN(H); if (OT = 24) then { 24 = Extrudes } H := CnvrtToGenericSolid(H); End; { ConvertIt } BEGIN ForEachObjectInList(ConvertIt, 0, 2, FSymDef); SysBeep; { make a noise when done } END; Run(Extr2Solids); Raymond Quote Link to comment
Pat Stanford Posted February 13, 2023 Share Posted February 13, 2023 Your criteria is set to show only extrudes so there is no symbol to display the name of. Take a look at the worksheet script in the following thread. It will get the name of the "parent" object of something in a worksheet. So the Parent of your extrude should be the symbol. Quote Link to comment
Pat Stanford Posted February 13, 2023 Share Posted February 13, 2023 And again, here is my version of what Raymond posted. This one converts extrudes and CGS solids that are the only object in a 3D only symbol to Generic Solids. With this as a base you could then also script converting those symbols to Groups which, since it only contains a single object should give you the actual object instead of a group. Procedure ConvertToGenericSolids; {©2023 Pat Stanford - pat@coviana.com} {licensed under the Boost Software License 1.0} {https://github.com/boostorg/boost/blob/master/LICENSE_1_0.txt} {TL/DR Use as you want, attribution for source, No warranty} {This script finds every 3D only symbol in a file that has} {exactly 1 extrude or CGS Solids object and converts that object} {to a generic solid.} VAR ThisSymbol, ThisObject, GenericObject, H1 :Handle; RList, NumItems, L3 :LongInt; N1,N2,OType :Integer; BEGIN RList:=BuildResourceList(16, 0, '', NumItems); {Build a list of all symbols in file} For L3:=1 to NumItems DO {Loop through the symbols} BEGIN ThisSymbol:=GetResourceFromList(RList, L3); If GetSymbolType(ThisSymbol)=1 THEN {1 = 3D only symbol} BEGIN ThisObject:=FInSymDef(ThisSymbol); {Handle to first object in sym Def} OType:=GetType(ThisObject); If (((OType=84) | (OType=24)) & (NextObj(ThisObject)=Nil)) then {CGS Solid and only object in SymDef} GenericObject:=CnvrtToGenericSolid(ThisObject); End; End; End; Run(ConvertToGenericSolids); Quote Link to comment
Elite Exhibits Posted February 24, 2023 Author Share Posted February 24, 2023 Pat / Raymond These scripts worked extremely well - Thank You - We are converting files to export into Form-Z and the Solids (via STEP files) transfer nicely / accurately. ¿ What I am wondering is the difference - CGS solids vs Generic Solids ? (No luck searching help or site:forum.vectorworks.net) I use a Worksheet / Databse: ALL IIems to check what is in the drawing. ( =T & =ST ) - see attached The Worksheet shows Extrude, Mesh, Group, CGS Solid, (Etcetera...) but never "Generic Solid" OIP states that an item is a "Generic Solid" Menu states "Convert to Generic Solid" ... and searching the HELP for CGS Solids returns the proverbial deer in headlights Assistance is always Appreciated ! Peter Search VW HELP for CGS Solids.pdf Item Type in Worksheet.pdf Quote Link to comment
MullinRJ Posted February 24, 2023 Share Posted February 24, 2023 (edited) Hi Peter, As I understand it, CSG Solids contain history, while Generic Solids do not. CSG stands for Constructive Solids Geometry, which implies it is made from operations with other Solids. With the solid's history, you can enter a CSG Solid and see what composes it, like Solid Addition / Subtraction operations, and/or Filleting / Chamfering operations. Each of those can subsequently be entered and edited. Then you can back out to see the result. With Generic Solids you cannot enter them to perform any edits. You can only scale, and rotate them. I assume the memory requirements are much less for Generic Solids, though I've never compared them. HTH, Raymond PS - I just tried this to confirm – you can use Generic Solids in subsequent Solid Operations. So, a CSG Solid can contain solid primitives (like extrudes, etc.), other CSG solids, and Generic Solids. Edited February 24, 2023 by MullinRJ Quote Link to comment
Pat Stanford Posted February 24, 2023 Share Posted February 24, 2023 A Generic Solids is a CGS solid with all the history striped out. You can use it to perform other CGS operations (Add, Subtract, etc), but you can't get back into the "history" of an object once it has been made Generic. If you have a complicated object (multiple add/subtracts/fillets) that you "know" you are never going to need to change (make a backup copy first anyway) then you can save some calculation time by VW not having to perform each of those operations every time the object is redrawn. This is especially important if you are going to use the object multiple times (even as part of a symbol) in the drawing. Think about something like 100 or 1000 screws that are made of three different sweeps, each with fillets, and solid subtractions to give the drive slots. Complicated and "computationally expensive" to use in a drawing. Convert that to Generic Solid and you will only have to work with the external geometry, not all of the steps it took to make it in the first place. Much less "computational expense". HTH Quote Link to comment
Elite Exhibits Posted February 24, 2023 Author Share Posted February 24, 2023 Then the Question would be Should I see "Generic Solids" in a Worksheet/Databse/All Items ? (Vs only seeing "CGS Solids" after running the above scripts ...) Peter Quote Link to comment
MullinRJ Posted February 24, 2023 Share Posted February 24, 2023 (edited) The object type is the same for CSG and Generic Solids (84). I doubt worksheets can see the difference if they are just sorting by Object Type. @Pat Stanford may know better, so wait for his answer. After some quick testing, if your column header in a database row is =ObjectTypeName, you will see things like Extrude, Solid Addition, CSG Solid, etc. It appears the label CSG Solid refers to Generic Solids, while solid objects that have an editable history will be labeled by the outermost solids operation. if you just use =ObjectType for the column header, then you will see "84" for CSG Solids and Generic Solids. Other solids like Extrudes (24) and Sweeps (34) will show their respective object type numbers. HTH, Raymond Edited February 24, 2023 by MullinRJ additional comments 1 Quote Link to comment
MullinRJ Posted February 24, 2023 Share Posted February 24, 2023 The same applies for =T, for the column header. CSG and Generic Solids will both show as CSG Solids. 1 Quote Link to comment
EBV_Nick Posted March 6, 2024 Share Posted March 6, 2024 Hey all, Circling back to this for a very similar issue. I'm ingesting a huge Revit model that is made up of thousands of 3D symbols that are all made up of meshes. I've been going through and pretty painstakingly adding all of those meshes to a solid addition and then converting to a generic solid. I attempted with my near-zero knowledge of scripting to edit the above script @Pat Stanford posted to do this but unfortunately couldn't do it. If anyone could help out that would be incredible. I often find myself doing these repetitive operations going through large amounts of symbols in a drawing. If someone could help explain the outlines of a script that I could learn to change the bits to adapt to the types of operations I need to do that would be incredibly appreciated. Thanks! Quote Link to comment
MullinRJ Posted March 7, 2024 Share Posted March 7, 2024 Hi @EBV_Nick, Could you post an example file of your objects? It doesn't need to the whole file, maybe a few dozen symbols. The easiest way to create a sample file is to select a handful of objects, copy them, and paste them in place (Alt-V) in a new file. It will be easier to make suggestions if we can see actual data. Thank you, Raymond Quote Link to comment
EBV_Nick Posted March 14, 2024 Share Posted March 14, 2024 Hey @MullinRJ Unfortunately this file is super proprietary and I can't share any info from it. Essentially, every symbol is a solid object that is broken up into it's polygon faces with meshes (think a cube would be 6 meshes). I went through each symbol and added all the meshes together and then converted to generic solids. I believe the order of operations I'm looking for is: - Enter each symbol (all are in the main root) - Select all objects (they should all be meshes) - Add all objects together - Convert solid addition to generic solid - rinse and repeat Apologies for not being able to post a sample file, but hopefully this is enough info. Hoping to dive into VS soon myself and eventually I'll be able to provide my own solutions to my own problems! (hopefully) Thanks! 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.