Jump to content
Pat Stanford

Copy Dimension Text into Attached Record/Field

Recommended Posts

In response to a post on the General Discussion, I put this script together. It will copy the data in the Dimension String of a Dimension object into a user attached Record named "DimFomat" and Field named "MyField". Change the Const values to whatever you need.

The thread that started this is https://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=209786#Post209786

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

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...