Jump to content

Help with Auto Record Formats/ Fields?


Recommended Posts

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

 

Link to comment

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

  • Like 1
Link to comment

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. 

 

 

Link to comment

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? 

 

 

Link to comment

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.

  • Like 1
Link to comment
  • 3 weeks later...

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);

 

Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...