Jump to content

Changing scale - current titleblock/ sheet layer


Recommended Posts

Hello,

 

I'm trying to figure out how the change the scale of the current titleblock/ sheet layer. i've no experience with scripting but i've managed to change an existing script for the scale fuction. the only thing is that it changes the scale of all title blocks. Can anyone help me or maby come up with a better idea?

 

#User defined project name
strProjectName = vs.StrDialog('Change Scale','1:');
#Sheet data record format and field
strRecordName = 'Title Block Sheet Data'
strRecordField = 'Scale'

def SetRecord(h):
    vs.SetRField(h,strRecordName,strRecordField,strProjectName);
    vs.ResetObject(h);
    
criteria = '((R in [' + "'" + strRecordName + "'" + ']))';

vs.ForEachObject( SetRecord, criteria);

 

 

Some additional questions:

1. Is it possible to place the script into the menubar?

2. In the title block manager you have a update scale button; is it possible to add this feature to the object info (without opening the title block manager)?

Link to comment
  • Vectorworks, Inc Employee

Hello @mlachenal,

 

About the script, what is the key thing here is that you are calling ForEachObject with a criteria. The criteria defines which are the objects which will get updated with this script. In your case, you have specified [criteria = '((R in [' + "'" + strRecordName + "'" + ']))';] which means all objects with the record with name strRecordName attached to them. In order to make this apply to less objects you have to adjust your criteria. For example, if you want this to apply to the selected objects only, you would have to use criteria = '((R in [' + "'" + strRecordName + "'" + ']) & (SEL=TRUE))';

 

I would advice you to generate your criteria using Custom Selection and creating a script from it. That way you can use the UI for creating of criteria and then copy the criteria from the generated script into your script.

 

1. I feel like the answer is no, but I am not 100% sure.

2. Can you create a wishlist item for this?

 

Best Regards,

Nikolay Zhelyazkov

Link to comment

@mlachenal You can get this script into your menu bar following the steps below:

  1. Open up the script editor that you wrote this in.  Select everything and copy it.
  2. Go to Tools - Plug-ins - Plug-in Manager.
  3. Click on the Custom Plug-ins tab.
  4. Click New.
  5. Select Command and give your command a name.
  6. With the new plug-in selected, click on the Edit Script button.
  7. Paste in your code, make sure the Language is set to Python, and click OK.
  8. Close the Plug-in Manager window.
  9. Go to Tools - Workspaces - Edit Current Workspace.
  10. Click on the Menus tab.
  11. In the box on the left, navigate down to the Miscellaneous category and expand it, your new command should be there.
  12. In the box on the right, find a place for your script to appear.
  13. Click and drag the plug-in from the box on the left into the box on the right.
  14. Click OK.

I should also note that the category that the plug-in appears with in the Workspace Editor is "Miscellaneous" by default but can be changed from the Plug-in Manager window by clicking the Edit Definition button and selecting a different category or creating your own.

  • Like 1
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...