ibenjamin.price Posted November 8, 2016 Share Posted November 8, 2016 How do I get a record format field to populate with a piece of information about the symbol. For example, i'd like to get : the volume information of the symbol to appear in a record field of said symbol. the location in X,Y,Z space in the design layer to appear in a record field of said symbol. the bounding cube size of the symbol L,W,H to appear in a record field of said symbol. the Surface Area of the Symbol to appear in a record field of said symbol. Would the best thing be to write a script that would grab that information, then populate it inside a specific record field? Thanks anyone for you help. -Ben Quote Link to comment
markdd Posted November 8, 2016 Share Posted November 8, 2016 You can attach field info to symbols by editing the symbol (2d/3D, either one ) and with NOTHING selected, go to the data tab in the OIP, fill in the fields of the data record that is attached to the symbol. It is important that nothing is selected though. Do not edit the data record itself unless you want all uses of that record to have that info. Hope that works for you Mark 1 Quote Link to comment
Pat Stanford Posted November 8, 2016 Share Posted November 8, 2016 Yes. For the information you are asking about you will need to write a script. Remember that the script will give you a snapshot. You will have to remember to rerun the script when you make changes to the symbols. Let us know if you need help. 1 Quote Link to comment
ibenjamin.price Posted November 8, 2016 Author Share Posted November 8, 2016 Mark, Thanks for the tip. I've been able to do that part thus far. My main question is about the auto data field population, like Volume for instance. I can get this information if I run the Machine Design : Get 3D Properties command. The I could fill this out in the symbol field by hand. But Im trying to get the information like that, to populate in the record field automatically after I run the script. This 3D Properties command has most of what I need. Now I need to figure out how to tie that to the Record Fields and then run the script. Im current trying to go at this from a marionette approach. Maybe there is a way using @DomCsymbol node to "get volume" information from a symbol and have that populate or "set record field"... Just spitballing here. I'll play around a bit more and upload my results. Quote Link to comment
ibenjamin.price Posted November 8, 2016 Author Share Posted November 8, 2016 Pat, Thanks for the confirmation. That all makes logical sense to me. Now to figure out the best way forward. Im gonna look into marionette first and see what I come up with. This is slightly easier for me then scripting, just because I can understand it better when its visual. Only problem there might be the nodes just don't exist for what I want to do, or they require some time of customization. In with case, its probably easier to do a script. Do you know of any good tutorials that cover any of this ground on Record Formats and auto population of data? This seems like a very straightforward script to me. and can get more detailed later on... but isn't it basically this? Symbol (symbol name: xxx) Record format (format name: Part Info) Record Field (field: x location) Record Field (field: y location) Record Field (field: z location) Procedure : Get x location Get y location Get z location Set Record Field String : X location Set Record Field String : Y location Set Record Field String : Z location Run: Im just not sure how to format all this info and if something like "get x location" or "set record field string" is the correct statement. I assume the same type of statements exist with "get volume" "Get total Surface area" "get bounding cube"... Is there a library of these statements somewhere where I can check to see if this is correct? Quote Link to comment
Marionette Maven Marissa Farrell Posted November 8, 2016 Marionette Maven Share Posted November 8, 2016 @ibenjamin.price If you need any help with Marionette (including custom nodes) let me or the rest of the Marionette community know and I'm sure we can help you figure it out. It's good practice for us and provides good resources for other users that may have a similar use case. 2 Quote Link to comment
Pat Stanford Posted November 8, 2016 Share Posted November 8, 2016 Personally, I would say this is a case for a script (vectorscript or python script) rather than Marionette. I think Marionette is great for creating object while scripts for this are clunky. For modifying existing object I would say scripts are better and Marionette is clunky. Others will disagree. I can give you the outline of the script. If you want to try Marionette first go ahead, but I won't be much help. 1 Quote Link to comment
ibenjamin.price Posted November 15, 2016 Author Share Posted November 15, 2016 Hey @Pat Stanford, I gave it hell with Marionette, but no luck. It seems that I cannot get the info I need from the Symbol. Marionette requires a 3D object in order to Get Volume. Im working with Symbols from the Resource browser. So thats a no go. Any chance you can help me with the Outline of this script? Any help is very much appreciated! Thanks! Ben Quote Link to comment
Pat Stanford Posted December 3, 2016 Share Posted December 3, 2016 Sorry to take so long to get back to you. Here is a script that grabs some data from a Dimension and stores it into a record. Add extra lines into the Execute procedure to get the information you need and store it into a record.field. You will also need to change the criteria in the ForEachObject line. Depending on how may objects you have it might be better to use a ForEachObjectInList procedure instead. Ask if you need more help. Procedure DimToRecordField; {Written in response to a request on the General Discussion Forum} {© Pat Stanford, April 2, 2015, Released into the Public Domain. No Rights Reserved} {Change the DimRecord and TheField constants to match your record and field names} {Script store the data from the DimText into a user attached record and field} Const DimRecord='DimFormat'; TheField='MyField'; Function HasRecord(H1:Handle; RecordName:String):Boolean; Var N1:Integer; Begin HasRecord:=False; For N1:= 1 to NumRecords(H1) do Begin If GetName(GetRecord(H1, N1))=DimRecord then HasRecord:=True; End; {You could add code here to SetRecord if you wanted to add the record} { to items that don't have it already attached} End; Procedure Execute(H1:Handle); Begin If HasRecord(H1,DimRecord) then SetRField(H1,DimRecord,TheField,GetDimText(H1)); End; Begin ForEachObject(Execute, (((T=DIMENSION) & (SEL=TRUE)))); End; Run(DimToRecordField); 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.