RoutingGeom Functions¶
This group of API functions is used to create and manipulate RoutingGeom objects, which define wire routing paths between points in the model.
|
Get the number of routing points in a RoutingGeom |
|
Add a routing point to a RoutingGeom. |
|
Add a routing point to a RoutingGeom. |
|
Delete a specified routing point from a RoutingGeom. |
|
Delete all routing points from a RoutingGeom. |
|
Move a specified routing point within the route of a RoutingGeom. |
|
Get the ParmContainer ID of a routing point within a RoutingGeom. |
|
Get the ParmContainer IDs of all the routing points within a RoutingGeom. |
|
Get the Geom ID of the geom a routing point is anchored to. |
|
Set the Geom ID of the geom a routing point is anchored to. |
|
Get the main coordinate location a routing point. |
|
Get the coordinate location a routing point in a RoutingGeom. |
|
Get the coordinate locations along a RoutingGeom. |
|
Get points along a RoutingGeom. |
Details¶
- openvsp.GetNumRoutingPts(routing_id)[source]¶
Get the number of routing points in a RoutingGeom
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) npt = vsp.GetNumRoutingPts(routing_geom) # Three points were added, and the count has to match the ID list. assert npt == 3, "GetNumRoutingPts did not count the points that were added" assert npt == len( vsp.GetAllRoutingPtIds( routing_geom ) ), "GetNumRoutingPts disagrees with GetAllRoutingPtIds" # Deleting one has to move the count. vsp.DelRoutingPt( routing_geom, 1 ) assert vsp.GetNumRoutingPts( routing_geom ) == npt - 1, "GetNumRoutingPts did not follow DelRoutingPt"
See also: AddRoutingPt, DelRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :rtype: int :return: int Number of routing points in specified RoutingGeom
- openvsp.AddRoutingPt(routing_id, geom_id, surf_index)[source]¶
Add a routing point to a RoutingGeom. The new point will be the last point in the route. The new point will be anchored to the specified geom and surface.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0)
See also: AddRoutingPt, DelRoutingPt, InsertRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :param [in]: geom_id string Geom ID of geom to anchor new routing point to :param [in]: surf_index int Index of surf to anchor new routing point to :rtype: string :return: string ParmContainer ID for the newly added routing point
- openvsp.InsertRoutingPt(routing_id, index, geom_id, surf_index)[source]¶
Add a routing point to a RoutingGeom. The new point will be inserted before the specified index. The new point will be anchored to the specified geom and surface.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) npt = vsp.GetNumRoutingPts(routing_geom) rptPre2 = vsp.InsertRoutingPt(routing_geom, 2, pod2, 0) uPre2 = vsp.GetParm( rptPre2, 'U', 'RoutePt') vsp.SetParmVal(uPre2, 0.)
See also: AddRoutingPt, DelRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to insert new point before :param [in]: geom_id string Geom ID of geom to anchor new routing point to :param [in]: surf_index int Index of surf to anchor new routing point to :rtype: string :return: string ParmContainer ID for the newly added routing point
- openvsp.DelRoutingPt(routing_id, index)[source]¶
Delete a specified routing point from a RoutingGeom.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) num_before_del = vsp.GetNumRoutingPts( routing_geom ) vsp.DelRoutingPt( routing_geom, 1 ) assert vsp.GetNumRoutingPts( routing_geom ) < num_before_del, "DelRoutingPt removed nothing"
See also: AddRoutingPt, DelAllRoutingPt :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to delete
- openvsp.DelAllRoutingPt(routing_id)[source]¶
Delete all routing points from a RoutingGeom.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) vsp.DelAllRoutingPt( routing_geom ) assert vsp.GetNumRoutingPts( routing_geom ) == 0, "DelAllRoutingPt left something behind"
See also: AddRoutingPt, DelRoutingPt :param [in]: routing_id string RoutingGeom Geom ID
- openvsp.MoveRoutingPt(routing_id, index, reorder_type)[source]¶
Move a specified routing point within the route of a RoutingGeom.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) before_ids = vsp.GetAllRoutingPtIds( routing_geom ) newindx = vsp.MoveRoutingPt( routing_geom, 1, vsp.REORDER_MOVE_DOWN ) # The point that was at index 1 is now at index 2, and its neighbour has # taken its place. after_ids = vsp.GetAllRoutingPtIds( routing_geom ) assert newindx == 2, "MoveRoutingPt did not move the point down" assert len( after_ids ) == len( before_ids ), "MoveRoutingPt changed the number of points" assert after_ids[2] == before_ids[1], "MoveRoutingPt did not swap the two points" assert after_ids[1] == before_ids[2], "MoveRoutingPt did not swap the two points"
See also: AddRoutingPt, DelRoutingPt, REORDER_TYPE :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to move :param [in]: reorder_type int Enum specifying reordering type (i.e. REORDER_MOVE_UP, REORDER_MOVE_DOWN, REORDER_MOVE_TOP, REORDER_MOVE_BOTTOM)
- openvsp.GetRoutingPtID(routing_id, index)[source]¶
Get the ParmContainer ID of a routing point within a RoutingGeom.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) rid = vsp.GetRoutingPtID(routing_geom, 2)
See also: AddRoutingPt, DelAllRoutingPt, GetAllRoutingPtIds :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to ID to retreive :rtype: string :return: string ParmContainer ID for the specified routing point
- openvsp.GetAllRoutingPtIds(routing_id)[source]¶
Get the ParmContainer IDs of all the routing points within a RoutingGeom. The vector will contain the IDs in order.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) rpts = vsp.GetAllRoutingPtIds(routing_geom)
See also: AddRoutingPt, DelAllRoutingPt, GetRoutingPtId :param [in]: routing_id string RoutingGeom Geom ID :rtype: std::vector< std::string,std::allocator< std::string > > :return: vector<string> Vector of routing point ParmConatiner IDs
- openvsp.GetRoutingPtParentID(pt_id)[source]¶
Get the Geom ID of the geom a routing point is anchored to.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) gid = vsp.GetRoutingPtParentID(rpt1)
See also: AddRoutingPt, DelAllRoutingPt, GetAllRoutingPtIds :param [in]: pt_id string ParmContainer ID of desired routing point :rtype: string :return: string Geom ID for the geom the routing point is anchored to
- openvsp.SetRoutingPtParentID(pt_id, parent_id)[source]¶
Set the Geom ID of the geom a routing point is anchored to.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) vsp.SetRoutingPtParentID(rpt1, pod1)
See also: AddRoutingPt, DelAllRoutingPt, GetAllRoutingPtIds :param [in]: pt_id string ParmContainer ID of desired routing point :param [in]: parent_id string Geom ID for the geom to anchor the routing point to
- openvsp.GetMainRoutingPtCoord(pt_id)[source]¶
Get the main coordinate location a routing point. The main location is the location of the base copy before symmetry has been applied.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) vsp.Update() p1 = vsp.GetMainRoutingPtCoord(rpt1) # rpt1 rides on pod2, which was moved two units out in Y. assert abs( p1.y() - 2.0 ) < 1e-6, "GetMainRoutingPtCoord did not follow the parent Geom" # With no symmetry applied, the main copy is also symm_index 0. assert vsp.dist( p1, vsp.GetRoutingPtCoord( routing_geom, 1, 0 ) ) < 1e-6, "GetMainRoutingPtCoord disagrees with GetRoutingPtCoord"
See also: AddRoutingPt, DelRoutingPt, GetRoutingPtCoord, GetAllRoutingPtCoords, GetRoutingCurve :param [in]: pt_id string ParmContainer ID of desired routing point :rtype:
vec3d:return: vec3d coordinate of main routing point
- openvsp.GetRoutingPtCoord(routing_id, index, symm_index)[source]¶
Get the coordinate location a routing point in a RoutingGeom. The main location is symm_index = 0.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) vsp.Update() p1 = vsp.GetRoutingPtCoord(routing_geom, 1, 0) # rpt1 rides on pod2, which was moved two units out in Y. assert abs( p1.y() - 2.0 ) < 1e-6, "GetRoutingPtCoord did not follow the parent Geom" # The indexed point has to be the second of the three that were added. pvec = vsp.GetAllRoutingPtCoords(routing_geom, 0) assert len( pvec ) == 3, "GetAllRoutingPtCoords returned the wrong number of points" assert vsp.dist( p1, pvec[1] ) < 1e-6, "GetRoutingPtCoord disagrees with GetAllRoutingPtCoords"
See also: AddRoutingPt, DelRoutingPt, GetMainRoutingPtCoord, GetAllRoutingPtCoords, GetRoutingCurve :param [in]: routing_id string RoutingGeom Geom ID :param [in]: index int Index of routing point to get cordinate of :param [in]: symm_index int Symmetry index to get coordinate of :rtype:
vec3d:return: vec3d coordinate of routing point
- openvsp.GetAllRoutingPtCoords(routing_id, symm_index)[source]¶
Get the coordinate locations along a RoutingGeom. The main copy is symm_index = 0.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) vsp.Update() pvec = vsp.GetAllRoutingPtCoords(routing_geom, 0) # One coordinate per routing point, in the order they were added. assert len( pvec ) == 3, "GetAllRoutingPtCoords returned the wrong number of points" # rpt0 sits at the nose of pod1 and rpt2 at its tail, both on the # centerline. rpt1 rides on pod2, two units out in Y. assert abs( pvec[0].y() ) < 1e-6, "GetAllRoutingPtCoords did not follow the parent Geoms" assert abs( pvec[1].y() - 2.0 ) < 1e-6, "GetAllRoutingPtCoords did not follow the parent Geoms" assert abs( pvec[2].y() ) < 1e-6, "GetAllRoutingPtCoords did not follow the parent Geoms" assert pvec[2].x() > pvec[0].x(), "GetAllRoutingPtCoords did not order the points by U" assert vsp.dist( pvec[1], vsp.GetMainRoutingPtCoord( rpt1 ) ) < 1e-6, "GetAllRoutingPtCoords disagrees with GetMainRoutingPtCoord"
See also: AddRoutingPt, DelRoutingPt, GetMainRoutingPtCoord, GetRoutingPtCoord, GetRoutingCurve :param [in]: routing_id string RoutingGeom Geom ID :param [in]: symm_index int Symmetry index to get coordinate of :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector < vec3d > coordinate of routing points along RoutingGeom
- openvsp.GetRoutingCurve(routing_id, symm_index)[source]¶
Get points along a RoutingGeom. These points will follow the curve of a RoutingGeom with radiused routing points. The main copy is symm_index = 0.
pod1 = vsp.AddGeom('POD', '') pod2 = vsp.AddGeom('POD', '') ypod2 = vsp.GetParm(pod2, 'Y_Rel_Location', 'XForm') vsp.SetParmVal(ypod2, 2.0) routing_geom = vsp.AddGeom('ROUTING', '') rpt0 = vsp.AddRoutingPt(routing_geom, pod1, 0) u0 = vsp.GetParm( rpt0, 'U', 'RoutePt') vsp.SetParmVal(u0, 0.0) rpt1 = vsp.AddRoutingPt(routing_geom, pod2, 0) rpt2 = vsp.AddRoutingPt(routing_geom, pod1, 0) u2 = vsp.GetParm( rpt2, 'U', 'RoutePt') vsp.SetParmVal(u2, 1.0) vsp.Update() pvec = vsp.GetRoutingCurve(routing_geom, 0) # The curve is tessellated, so it carries at least as many points as there # are routing points, and it has to start and end on them. rpts = vsp.GetAllRoutingPtCoords(routing_geom, 0) assert len( pvec ) >= len( rpts ), "GetRoutingCurve returned too few points" assert vsp.dist( pvec[0], rpts[0] ) < 1e-6, "GetRoutingCurve does not start on the first routing point" assert vsp.dist( pvec[-1], rpts[-1] ) < 1e-6, "GetRoutingCurve does not end on the last routing point"
See also: AddRoutingPt, DelRoutingPt, GetMainRoutingPtCoord, GetRoutingPtCoord, GetAllRoutingPtCoords :param [in]: routing_id string RoutingGeom Geom ID :param [in]: symm_index int Symmetry index to get coordinate of :rtype: std::vector< vec3d,std::allocator< vec3d > > :return: vector < vec3d > coordinate of points along RoutingGeom curve