Jump to content
Developer Wiki and Function Reference Links ×

Setting Tool Defaults With A Script


Sean R.

Recommended Posts

Hello,

 

I have been using vectorworks for 1 year and am new to vectorscripts. I would like to make a script that sets the default settings of the Stake tool. I read some other posts about a similar topic but am not able to understand the solution. I can't seem to properly call up the record and change the field value for the tool and I can figure out how to find the record for the tool to make sure I trying to edit the right record. Anyone know how to change the stake tool and have a working script or a sample one on how to do this?

 

Thanks

Link to comment

Normaly you can't modify any tool defaults with VS. What you can do is modify the default parametric record used in creating a new object.

The parametric record is unique and can be retrieved with the unique name of the object. You can get the handle with GetNamedObject or some similar function taking a string.

 

The normal Get/Set record field functions will work on this handle.

Link to comment

This should get you started.

Modify the <> wrappers to the exact name, recordname and value you want to modify.

 

Note that you might need to native object name which can differ from the visual localised objectname.

Procedure EditRecordFormat;
VAR
ObjectName :String;
RecordFormat: Handle;
ObjectType: Integer;

BEGIN
	ObjectName := '<ObjectName>';

	RecordFormat := NIL;
	RecordFormat := GetObject(ObjectName);
	IF (RecordFormat <> NIL) THEN
	BEGIN
		ObjectType := GetTypeN(RecordFormat);

		IF (ObjectType = 47) THEN
		BEGIN
			SetRField(RecordFormat, ObjectName, '<FieldName>','<FieldValue>');
		END;
	END;
END;
RUN(EditRecordFormat);

 

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...