Measure Tool Functions¶
This group of API functions can be used to control the Ruler Tool through the API.
Create a new Ruler and add it to the Measure Tool |
|
Hide every Ruler in the Measure Tool. |
|
Show every Probe in the Measure Tool. |
|
Hide every Probe in the Measure Tool. |
|
Show every Protractor in the Measure Tool. |
|
Hide every Protractor in the Measure Tool. |
|
Show every RST Probe in the Measure Tool. |
|
Hide every RST Probe in the Measure Tool. |
|
|
Add a protractor measuring the angle at a middle point between two others, each given as a surface coordinate on a Geom. |
Get an array of all Protractor IDs from the Measure Tool |
|
|
Delete a particular Protractor from the Measure Tool |
Delete all Protractors from the Measure Tool |
|
|
Create and add an RST Probe object to the Measure Tool. |
Get an array of all RST Probe IDs from the Measure Tool |
|
|
Delete a particular RST Probe from the Measure Tool |
Delete all RST Probes from the Measure Tool |
|
|
Add a ruler between two points on the model, each given as a surface coordinate on a Geom. |
Get an array of all Ruler IDs from the Measure Tool |
|
|
Delete a particular Ruler from the Measure Tool |
Delete all Rulers from the Measure Tool |
|
|
Create a new Probe and add it to the Measure Tool |
Get an array of all Probe IDs from the Measure Tool |
|
|
Delete a specific Probe from the Measure Tool |
Delete all Probes from the Measure Tool |
Details¶
- openvsp.ShowAllRulers()[source]¶
Create a new Ruler and add it to the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) pid2 = AddGeom( "POD", "" ) SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 ) rid = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" ) SetParmVal( FindParm( rid, "X_Offset", "Measure" ), 6.0 )
- Parameters:
[in] – startgeomid string Start parent Geom ID
[in] – startsurfindx int Main surface index from the staring parent Geom
[in] – startu double Surface u (0 - 1) start coordinate
[in] – startw double Surface w (0 - 1) start coordinate
[in] – endgeomid string End parent Geom ID
[in] – endsurfindx int Main surface index on the end parent Geom
[in] – endu double Surface u (0 - 1) end coordinate
[in] – endw double Surface w (0 - 1) end coordinate
[in] – name string Ruler name
- Return type:
void
- Returns:
string Ruler ID
Create and add a Protractor object from three points on Geom surfaces. The angle is measured at the middle point, between the legs running out to the start and end points.
pod1 = AddGeom( "POD", "" ) pid = AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Example_Protractor" ) assert len( pid ) > 0 and pid != "NONE", "AddProtractor returned no id" # The new protractor is the only one in the model. prot_array = GetAllProtractors() assert len( prot_array ) == 1, "AddProtractor did not add the protractor" assert prot_array[0] == pid, "AddProtractor did not add the protractor" # Protractors are their own Parm Containers, so the name is readable. assert GetContainerName( pid ) == "Example_Protractor", "AddProtractor did not name the protractor"
See also: GetAllProtractors, DelProtractor, DeleteAllProtractors, AddRuler :param [in]: startgeomid string Start parent Geom ID :param [in]: startsurfindx int Start surface index from the start parent Geom :param [in]: startu double Start U (0 - 1) surface coordinate :param [in]: startw double Start W (0 - 1) surface coordinate :param [in]: midgeomid string Middle parent Geom ID :param [in]: midsurfindx int Middle surface index from the middle parent Geom :param [in]: midu double Middle U (0 - 1) surface coordinate :param [in]: midw double Middle W (0 - 1) surface coordinate :param [in]: endgeomid string End parent Geom ID :param [in]: endsurfindx int End surface index from the end parent Geom :param [in]: endu double End U (0 - 1) surface coordinate :param [in]: endw double End W (0 - 1) surface coordinate :param [in]: name string Protractor name :rtype: void :return: string Protractor ID
Show every Ruler in the Measure Tool. This is the Measure screen’s Show All button for rulers.
pod1 = AddGeom( "POD", "" ) rid = AddRuler( pod1, 0, 0.2, 0.0, pod1, 0, 0.8, 0.0, "Example_Ruler" ) HideAllRulers() # Visibility is a Parm on the ruler itself. assert abs( GetParmVal( FindParm( rid, "Visible", "Measure" ) ) ) < 1e-12, "HideAllRulers did not hide the ruler" ShowAllRulers() assert abs( GetParmVal( FindParm( rid, "Visible", "Measure" ) ) - 1.0 ) < 1e-12, "ShowAllRulers did not show the ruler"
See also: HideAllRulers, AddRuler
- openvsp.HideAllRulers()[source]¶
Hide every Ruler in the Measure Tool.
pid = AddGeom( "POD" ) Update() AddRuler( pid, 0, 0.2, 0.0, pid, 0, 0.8, 0.0, "R" ) HideAllRulers()
See also: ShowAllRulers
- openvsp.ShowAllProbes()[source]¶
Show every Probe in the Measure Tool.
pid = AddGeom( "POD" ) Update() AddProbe( pid, 0, 0.5, 0.5, "P" ) ShowAllProbes()
See also: HideAllProbes
- openvsp.HideAllProbes()[source]¶
Hide every Probe in the Measure Tool.
pid = AddGeom( "POD" ) Update() AddProbe( pid, 0, 0.5, 0.5, "P" ) HideAllProbes()
See also: ShowAllProbes
- openvsp.ShowAllProtractors()[source]¶
Show every Protractor in the Measure Tool.
pid = AddGeom( "POD" ) Update() AddProtractor( pid, 0, 0.2, 0.0, pid, 0, 0.5, 0.0, pid, 0, 0.8, 0.0, "P" ) ShowAllProtractors()
See also: HideAllProtractors
- openvsp.HideAllProtractors()[source]¶
Hide every Protractor in the Measure Tool.
pid = AddGeom( "POD" ) Update() AddProtractor( pid, 0, 0.2, 0.0, pid, 0, 0.5, 0.0, pid, 0, 0.8, 0.0, "P" ) HideAllProtractors()
See also: ShowAllProtractors
- openvsp.ShowAllRSTProbes()[source]¶
Show every RST Probe in the Measure Tool.
pid = AddGeom( "POD" ) Update() AddRSTProbe( pid, 0, 0.5, 0.5, 0.5, "P" ) ShowAllRSTProbes()
See also: HideAllRSTProbes
- openvsp.HideAllRSTProbes()[source]¶
Hide every RST Probe in the Measure Tool.
pid = AddGeom( "POD" ) Update() AddRSTProbe( pid, 0, 0.5, 0.5, 0.5, "P" ) HideAllRSTProbes()
See also: ShowAllRSTProbes
- openvsp.AddProtractor(startgeomid, startsurfindx, startu, startw, midgeomid, midsurfindx, midu, midw, endgeomid, endsurfindx, endu, endw, name)[source]¶
Add a protractor measuring the angle at a middle point between two others, each given as a surface coordinate on a Geom.
pid = AddGeom( "POD" ) Update() prid = AddProtractor( pid, 0, 0.2, 0.0, pid, 0, 0.5, 0.0, pid, 0, 0.8, 0.0, "TestProtractor" ) assert len( prid ) > 0, "AddProtractor returned no ID" assert len( GetAllProtractors() ) == 1, "AddProtractor did not add the protractor"
See also: GetAllProtractors, DelProtractor :param [in]: startgeomid string Geom ID the first leg starts on :param [in]: startsurfindx int Surface index on that Geom :param [in]: startu double U coordinate of the start, in [0, 1] :param [in]: startw double W coordinate of the start, in [0, 1] :param [in]: midgeomid string Geom ID the corner sits on :param [in]: midsurfindx int Surface index on that Geom :param [in]: midu double U coordinate of the corner, in [0, 1] :param [in]: midw double W coordinate of the corner, in [0, 1] :param [in]: endgeomid string Geom ID the second leg ends on :param [in]: endsurfindx int Surface index on that Geom :param [in]: endu double U coordinate of the end, in [0, 1] :param [in]: endw double W coordinate of the end, in [0, 1] :param [in]: name string Name for the protractor :rtype: string :return: string Protractor ID
- openvsp.GetAllProtractors()[source]¶
Get an array of all Protractor IDs from the Measure Tool
pod1 = AddGeom( "POD", "" ) AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" ) AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" ) prot_array = GetAllProtractors() assert len( prot_array ) == 2, "GetAllProtractors did not report both protractors" assert prot_array[0] != prot_array[1], "GetAllProtractors reported the same protractor twice"
See also: AddProtractor, DelProtractor, DeleteAllProtractors :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of Protractor IDs
- openvsp.DelProtractor(id)[source]¶
Delete a particular Protractor from the Measure Tool
pod1 = AddGeom( "POD", "" ) pid1 = AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" ) pid2 = AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" ) DelProtractor( pid1 ) # Only the named protractor goes. prot_array = GetAllProtractors() assert len( prot_array ) == 1, "DelProtractor removed the wrong protractor" assert prot_array[0] == pid2, "DelProtractor removed the wrong protractor"
See also: AddProtractor, GetAllProtractors, DeleteAllProtractors :param [in]: id string Protractor ID
- openvsp.DeleteAllProtractors()[source]¶
Delete all Protractors from the Measure Tool
pod1 = AddGeom( "POD", "" ) AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" ) AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" ) DeleteAllProtractors() assert len( GetAllProtractors() ) == 0, "DeleteAllProtractors left protractors behind"
See also: AddProtractor, GetAllProtractors, DelProtractor
- openvsp.AddRSTProbe(geomid, surfindx, r, s, t, name)[source]¶
Create and add an RST Probe object to the Measure Tool. An RST Probe marks a point in the volume of a Geom rather than on its surface.
pod1 = AddGeom( "POD", "" ) pid = AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "Example_RSTProbe" ) assert len( pid ) > 0 and pid != "NONE", "AddRSTProbe returned no id" # The new probe is the only one in the model, and it is not confused with a # surface probe. probe_array = GetAllRSTProbes() assert len( probe_array ) == 1, "AddRSTProbe did not add the probe" assert probe_array[0] == pid, "AddRSTProbe did not add the probe" assert len( GetAllProbes() ) == 0, "an RST probe was counted as a surface probe" assert GetContainerName( pid ) == "Example_RSTProbe", "AddRSTProbe did not name the probe"
See also: GetAllRSTProbes, DelRSTProbe, DeleteAllRSTProbes, AddProbe :param [in]: geomid string Parent Geom ID :param [in]: surfindx int Main surface index from the parent Geom :param [in]: r double R (0 - 1) volume coordinate :param [in]: s double S (0 - 1) volume coordinate :param [in]: t double T (0 - 1) volume coordinate :param [in]: name string RST Probe name :rtype: string :return: string RST Probe ID
- openvsp.GetAllRSTProbes()[source]¶
Get an array of all RST Probe IDs from the Measure Tool
pod1 = AddGeom( "POD", "" ) AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" ) AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" ) probe_array = GetAllRSTProbes() assert len( probe_array ) == 2, "GetAllRSTProbes did not report both probes" assert probe_array[0] != probe_array[1], "GetAllRSTProbes reported the same probe twice"
See also: AddRSTProbe, DelRSTProbe, DeleteAllRSTProbes :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Array of RST Probe IDs
- openvsp.DelRSTProbe(id)[source]¶
Delete a particular RST Probe from the Measure Tool
pod1 = AddGeom( "POD", "" ) pid1 = AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" ) pid2 = AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" ) DelRSTProbe( pid1 ) # Only the named probe goes. probe_array = GetAllRSTProbes() assert len( probe_array ) == 1, "DelRSTProbe removed the wrong probe" assert probe_array[0] == pid2, "DelRSTProbe removed the wrong probe"
See also: AddRSTProbe, GetAllRSTProbes, DeleteAllRSTProbes :param [in]: id string RST Probe ID
- openvsp.DeleteAllRSTProbes()[source]¶
Delete all RST Probes from the Measure Tool
pod1 = AddGeom( "POD", "" ) AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" ) AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" ) # Surface probes are a separate list and are left alone. AddProbe( pod1, 0, 0.5, 0.5, "Surface_Probe" ) DeleteAllRSTProbes() assert len( GetAllRSTProbes() ) == 0, "DeleteAllRSTProbes left probes behind" assert len( GetAllProbes() ) == 1, "DeleteAllRSTProbes removed a surface probe"
See also: AddRSTProbe, GetAllRSTProbes, DelRSTProbe
- openvsp.AddRuler(startgeomid, startsurfindx, startu, startw, endgeomid, endsurfindx, endu, endw, name)[source]¶
Add a ruler between two points on the model, each given as a surface coordinate on a Geom.
pid = AddGeom( "POD" ) Update() rid = AddRuler( pid, 0, 0.2, 0.0, pid, 0, 0.8, 0.0, "TestRuler" ) assert len( rid ) > 0, "AddRuler returned no ID" assert len( GetAllRulers() ) == 1, "AddRuler did not add the ruler"
See also: GetAllRulers, DelRuler :param [in]: startgeomid string Geom ID the ruler starts on :param [in]: startsurfindx int Surface index on the starting Geom :param [in]: startu double U coordinate of the start, in [0, 1] :param [in]: startw double W coordinate of the start, in [0, 1] :param [in]: endgeomid string Geom ID the ruler ends on :param [in]: endsurfindx int Surface index on the ending Geom :param [in]: endu double U coordinate of the end, in [0, 1] :param [in]: endw double W coordinate of the end, in [0, 1] :param [in]: name string Name for the ruler :rtype: string :return: string Ruler ID
- openvsp.GetAllRulers()[source]¶
Get an array of all Ruler IDs from the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) pid2 = AddGeom( "POD", "" ) SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 ) rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" ) rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" ) ruler_array = GetAllRulers() assert len( ruler_array ) > 0, "GetAllRulers returned nothing" print("Two Rulers") for n in range(len(ruler_array)): print( ruler_array[n] )
- Return type:
std::vector< std::string,std::allocator< std::string > >
- Returns:
vector<string> Vector of Ruler IDs
- openvsp.DelRuler(id)[source]¶
Delete a particular Ruler from the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) pid2 = AddGeom( "POD", "" ) SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 ) rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" ) rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" ) ruler_array = GetAllRulers() num_before_del = len( GetAllRulers() ) DelRuler( ruler_array[0] ) assert len( GetAllRulers() ) < num_before_del, "DelRuler removed nothing"
- Parameters:
[in] – id string Ruler ID
- openvsp.DeleteAllRulers()[source]¶
Delete all Rulers from the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) pid2 = AddGeom( "POD", "" ) SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 ) rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" ) rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" ) DeleteAllRulers() assert len( GetAllRulers() ) == 0, "DeleteAllRulers left something behind"
- openvsp.AddProbe(geomid, surfindx, u, w, name)[source]¶
Create a new Probe and add it to the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) probe_id = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" ) SetParmVal( FindParm( probe_id, "Len", "Measure" ), 3.0 )
- Parameters:
[in] – geomid string Parent Geom ID
[in] – surfindx int Main surface index from the parent Geom
[in] – u double Surface u (0 - 1) coordinate
[in] – w double Surface w (0 - 1) coordinate
[in] – name string Probe name
- Return type:
string
- Returns:
string Probe ID
- openvsp.GetAllProbes()[source]¶
Get an array of all Probe IDs from the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) probe_id = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" ) probe_array = GetAllProbes() assert len( probe_array ) > 0, "GetAllProbes returned nothing" print( "One Probe: ", False ) print( probe_array[0] )
- Return type:
std::vector< std::string,std::allocator< std::string > >
- Returns:
vector<string> Array of Probe IDs
- openvsp.DelProbe(id)[source]¶
Delete a specific Probe from the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) probe_id_1 = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" ) probe_id_2 = AddProbe( pid1, 0, 0.2, 0.3, "Probe 2" ) DelProbe( probe_id_1 ) probe_array = GetAllProbes() if len(probe_array) != 1 : print( "Error: DelProbe" ) assert False, "Error: DelProbe"
- Parameters:
[in] – id string Probe ID
- openvsp.DeleteAllProbes()[source]¶
Delete all Probes from the Measure Tool
pid1 = AddGeom( "POD", "" ) SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 ) probe_id_1 = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" ) probe_id_2 = AddProbe( pid1, 0, 0.2, 0.3, "Probe 2" ) DeleteAllProbes() probe_array = GetAllProbes() if len(probe_array) != 0 : print( "Error: DeleteAllProbes" ) assert False, "Error: DeleteAllProbes"