Start a new topic

vertex script

I need a script that will only work on vertices and will align all vertices. they can all be aligned to the first vertex in the list. I only need the x and y aligned. not the z.


Yes I know there is an align tool. For some reason that doesn't work for the export function that I am using (I have no way of changing that export function).


What works is manually re-entering the last decimal place in the attributes panel.


Also, is there a way to hotkey a script?


There are sample scripts provided with the OpenFlight API Installation in the samples/creatortools folder that may help you get started. See averagevertices.py specifically This is a script that performs the same function as the ModVertex Toolbox: Average Vertices tool in Creator. It could be easily modified to align 2nd and subsequent verts selected to the first. It also includes all the undo/redo capability you would need to make your script fully integrated into Creator.


Let us know if you have specific questions about implementing your script based on the code adapted from the averagevertices.py.


Note also that there are lots of other sample scripts distributed in samples/creatortools that show you how to do things that other Creator tools do. Very useful for learning.

To assign a shortcut to a script, you need to first publish your script. This is done by using the script editor's "Publish to Creator" command in the script editor's file menu. This will copy the script to a special folder inside of Creator. Any scripts published in this way will show up in the Define Keyboard Shortcuts window under the 'Scripts' section. (Not to be confused with the 'Scripts Menu' section nested in the 'Main Menu' section)


Another benefit of publishing scripts is that they show up in Creator's File Menu under "Scripts->Run Script." This allows you to place scripts directly on your Ribbon for quick access. (simply shift-drag the script from the menu onto the ribbon where you want it to be located.)


Keep in mind that this published script is a copy of your script. If you make changes to the original, they will not be reflected in the published script until you re-publish.

thanks

I actually don't see and samples or even a samples/creatortools folder. Where do I find those?

These are installed with the OpenFlight API.  Your path should look something like this:


c:\Presagis\SuiteXX\OpenFlight_API\samples\scripts\creatortools


Where SuiteXX is your suite folder name (Suite18, Suite19 etc.)

Login to post a comment