FormIt C++ API  v23.0.0 (2023.0.0)
WSM::Utils Namespace Reference

Classes

class  HistoryBoundsHelper
 This is a helper class to find the bounds of the Objects that are visible in the Model. class HistoryBoundsHelper. More...
 
class  HistoryObjects
 This is a helper class to convert the many representations of Objects used by the WSM APIs.class HistoryObjects. More...
 
class  IAppHelper
 IAppHelper is the interface for an application helper class.class IAppHelper. More...
 
class  ICamera
 ICamera is an interface supplied by the application to query the camera class ICamera. More...
 
class  ITooltipProvider
 ITooltipProvider is an interface supplied by the application to display the tooltip class ITooltipProvider. More...
 
class  MaterialData
 Data that stores all the material properties to be collected by GetAllRenderingInformation. More...
 
class  MeshData
 Data that can be used to draw a single mesh. More...
 
class  MeshesAndTransformsData
 Data that packages meshes and transforms together. More...
 
struct  ObjectTypeFilter
 struct ObjectTypeFilter More...
 
class  PickRay
 PickRay is a class containing all the information needed to do a pick in perspective and parallel views.class PickRay. More...
 
class  RayFireFilterHidden
 Implemetation of IRayFireFilterAndAbort that filters hidden objects. More...
 
class  RayFireFilterHiddenOrNonPickable
 Implemetation of IRayFireFilterAndAbort that filters hidden and and non pickable objects Note that this implementation does not use a pick ray, as it is used by area seletion where no pick ray exists. More...
 
class  RayFireFilterHiddenOrSectioned
 Implemetation of IRayFireFilterAndAbort that filters hidden and/or sectioned objects. More...
 

Typedefs

using ObjectIDsAndPickPoints = 1::vector< 1::pair< size_t, WSM::Point3d >>
 The selection related functions below that do not take a history ID obtain an IToolAppHelper from the InferenceEngine and use its interface functions to determine the history and in-context editing settings to use. More...
 
using ObjectsAndPickPoints = 1::vector< 1::pair< GroupInstancePath, WSM::Point3d >>
 

Enumerations

enum  ObjectTypes { ObjectTypes::NONE = 0, ObjectTypes::ExcludeImages = 1 << 0, ObjectTypes::ExcludeSectionPlanes = 1 << 1 }
 
enum  CurveType { CurveType::Unknown = 0, CurveType::Line = 1, CurveType::Circle = 2, CurveType::Spline = 3 }
 
enum  SurfaceType {
  SurfaceType::Unknown = 0, SurfaceType::Plane = 1, SurfaceType::Cylinder = 2, SurfaceType::Sphere = 3,
  SurfaceType::Extrude = 4, SurfaceType::Blend = 5
}
 
enum  SelectionLevel {
  SelectionLevel::BreakAtJunctionNonSmooth = 0, SelectionLevel::BreakAtJunction = 1, SelectionLevel::ConnectedFacesVariant = 2, SelectionLevel::ConnectedFacesComponents = 3,
  SelectionLevel::ConnectedFacesVariantComponents = 4, SelectionLevel::AllConnected = 5
}
 SelectionLevel is used as input to ExpandSelection to control how the given Object is expanded out to additional Objects. More...
 
enum  TooltipType { TooltipType::TOOLTIP = 0, TooltipType::STATUS = 1, TooltipType::NONE }
 
enum  CoordSystem { CoordSystem::HCS = 0, CoordSystem::LCS = 1, CoordSystem::WHCS = 2, CoordSystem::WLCS = 3 }
 
enum  PickRayPlaneIntersection { PickRayPlaneIntersection::WorkPlane = 0, PickRayPlaneIntersection::GroundPlane = 1, PickRayPlaneIntersection::CameraPlane = 2 }
 enum for return value of GetPickrayIntersectionWithWorkPlane More...
 

Functions

WSM_EXPORT bool DeleteHiddenObjects (const size_t nTopHistoryID)
 Function that deletes hidden objects in nTopHistoryID and all histories reachable from it. More...
 
WSM_EXPORT bool DeleteObjectsForEnergyAnaysis (const size_t nTopHistoryID)
 Function that deletes objects that are hidden or not a mass category for energy analysis in nTopHistoryID and all histories reachable from it. More...
 
WSM_EXPORT bool IsSectionPlane (size_t nHistoryID, size_t nObjectID)
 Returns true if an instance or group's reference history is a section plane. More...
 
WSM_EXPORT bool UnnestOrExplodeNestedGroups (const size_t nTopHistoryID)
 Helper function that gets rid of nested Groups. More...
 
WSM_EXPORT bool GetStringAttributeForObject (size_t nHistoryID, size_t nObjectID, const 1::string &key, 1::string &value)
 Gets the string attribute value for a given object and key. More...
 
constexpr bool enable_bitmask_operators (ObjectTypes)
 enable_bitmask_operators() function. More...
 
WSM_UTILS_EXPORT void RegisterAppHelper (1::unique_ptr< IAppHelper > pAppHelper)
 Register a concrete instance of the IAppHelper interface. More...
 
WSM_UTILS_EXPORT void UnregisterAppHelper ()
 Unregister the previously registered IAppHelper instance. More...
 
WSM_UTILS_EXPORT IAppHelperGetAppHelper ()
 Get the currently registered IAppHelper object. More...
 
WSM_UTILS_EXPORT bool IsObjectType (size_t nHistoryID, size_t id, nObjectType type)
 IsObjectType takes a WSM 'id' and returns true if the object (id) is of the given 'type'. More...
 
WSM_UTILS_EXPORT bool IsObjectType (size_t nHistoryID, size_t id, 1::vector< nObjectType > const &aTypes)
 IsObjectType takes a WSM 'id' and returns true if the object (id) is of any of the given 'types'. More...
 
WSM_UTILS_EXPORT bool IsLayerHidden (size_t nHistoryID, size_t id)
 Takes a WSM 'id' and returns true if the layer is hidden. More...
 
WSM_UTILS_EXPORT bool IsLayerNotPickable (size_t nHistoryID, size_t id)
 Takes a WSM 'id' and returns true if the layer is not pickable. More...
 
WSM_UTILS_EXPORT bool IsObjectNotPickable (size_t nHistoryID, size_t id)
 Takes a WSM 'id' and returns true if the object is on a non pickable layer. More...
 
WSM_UTILS_EXPORT bool IsObjectNotPickableByPath (GroupInstancePath const &groupInstancePath)
 Takes a WSM 'id' and returns true if the object is on a non pickable layer. More...
 
WSM_UTILS_EXPORT bool IsObjectHidden (size_t nHistoryID, size_t id)
 Takes a WSM 'id' and returns true if the object is on a hidden layer. More...
 
WSM_UTILS_EXPORT bool IsObjectHiddenByPath (GroupInstancePath const &groupInstancePath)
 Takes a WSM path and returns true if the object is on a hidden layer. More...
 
WSM_UTILS_EXPORT bool ObjectCanBeHidden (size_t nHistoryID, size_t nObjectID)
 Can this object be hidden directly? This means that it's non-owned or an instance. More...
 
WSM_UTILS_EXPORT bool ObjectCanBeNotPickable (size_t nHistoryID, size_t nObjectID)
 Can this object be not pickable directly? This means that it's non-owned or an instance. More...
 
WSM_UTILS_EXPORT bool IsTopLevelObjectHidden (size_t nHistoryID, size_t id)
 Takes a WSM 'id' and returns true if the object's top level owner is on a hidden layer. More...
 
WSM_UTILS_EXPORT bool IsTopLevelObjectNotPickable (size_t nHistoryID, size_t id)
 Takes a WSM 'id' and returns true if the object's top level owner is on a non pickable layer. More...
 
WSM_UTILS_EXPORT bool IsTopLevelObjectHiddenByPath (GroupInstancePath const &groupInstancePath)
 Takes a WSM path and returns true if the top level owner of any object in the path is on a hidden layer. More...
 
WSM_UTILS_EXPORT bool IsTopLevelObjectNotPickableByPath (GroupInstancePath const &groupInstancePath)
 Takes a WSM path and returns true if the top level owner of the final object in the path is on a not pickable layer. More...
 
WSM_UTILS_EXPORT Line3d GetEdgeLine (size_t nHistoryID, size_t edge)
 GetEdgeLine returns the line the 'edge' lies on. More...
 
WSM_UTILS_EXPORT bool GetCoedgePoints (size_t nHistoryID, size_t coedgeID, WSM::Point3d &begin, WSM::Point3d &end)
 GetCoedgePoints returns the begin/end points of coedge. More...
 
WSM_UTILS_EXPORT bool GetFacePoints (const GroupInstancePath &facePath, 1::vector< WSM::Point3d > &aPoints)
 Get all points of a face. More...
 
WSM_UTILS_EXPORT size_t GetEdgeIDFromCoedge (size_t nHistoryID, size_t coedgeID)
 Get edge Id from the given coedge. More...
 
WSM_UTILS_EXPORT size_t GetFaceIDFromCoedge (size_t nHistoryID, size_t coedgeID)
 Get face id from the given coedge. More...
 
WSM_UTILS_EXPORT bool ComputeFaceNormal (size_t historyID, size_t faceID, WSM::UnitVector3d &faceNormal)
 ComputeFaceNormal returns the face normal of the given face. More...
 
WSM_UTILS_EXPORT bool ComputeFaceCentroid (size_t historyID, size_t faceID, WSM::Point3d &centroid)
 ComputeFaceCentroid returns the centroid (average of all points) of the given face. More...
 
WSM_UTILS_EXPORT double AngleFullCircleInRadians (const WSM::UnitVector3d &normal, const WSM::Vector3d &vecA, const WSM::Vector3d &vecB, bool returnPositive=false)
 Calculates the radian angle counterclockwise from vector A to B on the plane with normal 'normal' If returnPositive, returns [0, 2PI) If not returnPositive, returns (-PI,PI]. More...
 
WSM_UTILS_EXPORT WSM::Result PickObjectsWithRay (PickRay const &pickRay, const ObjectTypeFilter &filter, bool bAllowAdjustRayRadius, bool bIgnoreInContext, ObjectIDsAndPickPoints &aObjectsAndPickPoints, bool bCullAgainstSectionPlanes=false)
 PickObjectsWithRay returns all objects that can be picked via the given pick ray, which is all objects up to the first face, as the face obscures everything behind it from picking. More...
 
WSM_UTILS_EXPORT WSM::Result PickObjectsWithRay (PickRay pickRay, const ObjectTypeFilter &filter, bool bAllowAdjustRayRadius, bool bAllowGroupGeometry, bool bRestrictGroupGeometryToEditingPath, bool bIgnoreInContext, ObjectsAndPickPoints &aObjectsAndPickPoints, bool bCullAgainstSectionPlanes=false)
 PickObjectsWithRay returns all objects that can be picked via the given pick ray, which is all objects up to the first face, as the face obscures everything behind it from picking. More...
 
WSM_UTILS_EXPORT void PickObjectsWithFilter (const PickRay &pickray, const ObjectTypeFilter &filter, SelectionLevel currentSelectionLevel, WSM::GroupInstancePath &firstSelectedObject, 1::vector< WSM::GroupInstancePath > &allSelectedObjects, ObjectsAndPickPoints &aObjectsAndPickPoints, bool bCullAgainstSectionPlanes=false)
 Common picking code for non-window. More...
 
WSM_UTILS_EXPORT void RemoveHiddenObjects (size_t nHistoryID, 1::vector< size_t > const &aObjectIDs, 1::vector< WSM::GroupInstancePath > const &aObjectsInGroupsVec, 1::vector< 1::pair< double, ptrdiff_t >> &paramIndexVec, const PickRay &pickray, bool bCullAgainstSectionPlanes=false)
 Removes objects on hidden layers from the data returned by the selection functions. More...
 
WSM_UTILS_EXPORT void RemoveNonPickableObjects (size_t nHistoryID, 1::vector< size_t > const &aObjectIDs, 1::vector< WSM::GroupInstancePath > const &aObjectsInGroupsVec, 1::vector< 1::pair< double, ptrdiff_t >> &paramIndexVec)
 Removes objects on non pickabke layers from the data returned by the selection functions. More...
 
WSM_UTILS_EXPORT void RemoveNonPickableObjects (size_t nHistoryID, 1::vector< size_t > &aObjectIDs, 1::vector< WSM::GroupInstancePath > &aObjectsInGroupsVec, 1::vector< WSM::Transf3d > &aGroupAggregateTransf3dVec)
 Removes objects on non pickable layers from the data returned by the selection functions. More...
 
WSM_UTILS_EXPORT bool SetToOwnerBody (WSM::GroupInstancePath &path)
 Returns true if the path was changed to the object's owner body. More...
 
WSM_UTILS_EXPORT void SelectionToGroupInstancePathArray (1::vector< size_t > const &aInput, 1::vector< GroupInstancePath > &aOutput)
 Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper. More...
 
WSM_UTILS_EXPORT void SelectionToGroupInstancePathArray (1::vector< ObjectHistoryID > const &aInput, 1::vector< GroupInstancePath > &aOutput)
 Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper. More...
 
WSM_UTILS_EXPORT GroupInstancePath SelectionToGroupInstancePath (size_t aObjectID)
 Takes an object ID value, and return a GroupInstancePath with that data and the current in-context editing settings from IToolAppHelper. More...
 
WSM_UTILS_EXPORT void AppendSelectionToGroupInstancePathArray (1::vector< size_t > const &aInput, 1::vector< GroupInstancePath > &aOutput)
 Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper. More...
 
WSM_UTILS_EXPORT void AppendSelectionToGroupInstancePathArray (1::vector< ObjectHistoryID > const &aInput, 1::vector< GroupInstancePath > &aOutput)
 Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper. More...
 
WSM_UTILS_EXPORT void SelectionFromGroupInstancePathArray (1::vector< size_t > &aOutput, 1::vector< GroupInstancePath > const &aInput)
 Takes a vector of GroupInstancePath objects, and populates the vector with the IDs of those compatible with the in-context editing settings from IToolAppHelper. More...
 
WSM_UTILS_EXPORT size_t PickGeometry (const PickRay &originalPickray, const ObjectTypeFilter &filter, bool bAllowAdjustRayRadius=true)
 PickGeometry is exactly the same as PickObjectsWithRay except that it returns the first result instead of an array of objects and pick points. More...
 
WSM_UTILS_EXPORT size_t PickBody (const PickRay &pickRay)
 PickBody returns the id of the body picked by pickRay. More...
 
WSM_UTILS_EXPORT size_t TestPickImages (size_t nHistoryID, const 1::vector< size_t > &imageIds, const PickRay &pickRay, Point3d &pickPointOnImage)
 Try picking the given Images with a pick ray If hits an image, returns the id of the picked image and the 3d point that was picked. More...
 
WSM_UTILS_EXPORT bool RayFireWithObjects (const 1::set< size_t > &objectIds, const PickRay &ray, WSM::Point3d &pickPointOnObject)
 Core ray fire function that tests ray intersection against a given set of objects. More...
 
WSM_UTILS_EXPORT::vector< size_t > GetAllNonOwnedGeometricObjects (size_t nHistoryID)
 Returns all non owned Objects of geometric type (Body, Face or Edge) in the given History. More...
 
WSM_UTILS_EXPORT SurfaceType GetFaceSurfaceType (size_t nHistoryID, size_t edgeId, size_t *pAttribID=nullptr)
 Returns Face surface type in surfaceType and also returns the surface attribute ID if attribID != nullptr. More...
 
WSM_UTILS_EXPORT CurveType GetEdgeCurveType (size_t nHistoryID, size_t edgeId, size_t *pAttribID=nullptr)
 Returns Edge curve type in curveType and also returns the curve attribute ID if attribID != nullptr. More...
 
WSM_UTILS_EXPORT void GetPointsOnEdgeCurve (size_t nHistoryID, size_t edgeId, const 1::vector< double > &params, 1::vector< WSM::Point3d > &points)
 Get points on the curve of an edge. More...
 
WSM_UTILS_EXPORT bool IsSilhouetteEdge (size_t nHistoryID, size_t edgeId, const Point3d &cameraPos, const Vector3d &cameraDir, bool perspectiveView)
 Determines if given edge is silhouette. More...
 
WSM_UTILS_EXPORT bool IsFreeEdge (size_t nHistoryID, size_t edgeId)
 Determines if given edge is an edge that is not between two faces ("free"). More...
 
WSM_UTILS_EXPORT bool IsBackFace (const WSM::GroupInstancePath &face, const Point3d &cameraPos, const Vector3d &cameraDir, bool perspectiveView)
 Check whether the given face is pointing away from the camera i.e. More...
 
WSM_UTILS_EXPORT bool IsSmooth (size_t nHistoryID, size_t objectID)
 Returns whether an edge or vertex is marked as smooth. More...
 
WSM_UTILS_EXPORT bool HasSmoothEdge (size_t nHistoryID, size_t objectID)
 Returns whether the provided object has any smooth edges. More...
 
WSM_UTILS_EXPORT bool ExpandSelection (size_t nHistoryID, size_t objectID, 1::vector< size_t > &expandedSelection, SelectionLevel selectionlevel, ObjectTypeFilter const *pFilter, bool bCanExpandInstances, WSM::Utils::PickRay const *pPickRay=nullptr)
 ExpandSelection expands the selection starting with objectID. More...
 
WSM_UTILS_EXPORT bool ExpandSelection (WSM::GroupInstancePath const &objectID, 1::vector< WSM::GroupInstancePath > &expandedSelection, SelectionLevel selectionlevel, ObjectTypeFilter const *pFilter, bool bCanExpandInstances, WSM::Utils::PickRay const *pPickRay=nullptr)
 
WSM_UTILS_EXPORT bool IsVertexOnCurve (size_t historyID, size_t vertexID)
 Returns whether a vertex is on an arc or hermite spline curve. More...
 
WSM_UTILS_EXPORT bool GetVertexCurveAttributes (size_t historyID, size_t vertexID, 1::vector< 1::pair< size_t, size_t >> &aAttributeIDs)
 GetVertexCurveAttributes looks at all the Edges hanging off the vertices and returns a vector of pairs (EdgeID, AttributeID) (aAttributeIDs) that have a curve attribute. More...
 
WSM_UTILS_EXPORT bool IsVertexEditable (size_t historyID, size_t vertexID)
 Returns whether a vertex is editable. More...
 
WSM_UTILS_EXPORT bool IsSelectAllConnected (size_t nHistoryID, const 1::vector< size_t > &selectedObjectIDs)
 Checks whether all the objects in the given vector are the result of select connected action (i.e. More...
 
WSM_UTILS_EXPORT bool IsSelectAllConnected (const 1::vector< WSM::GroupInstancePath > &selectedObjectPaths)
 Checks whether all the objects in the given vector are the result of select connected action (i.e. More...
 
WSM_UTILS_EXPORT bool MatchesSelectionType (const 1::vector< WSM::GroupInstancePath > &selectedObjectIDs, const 1::vector< WSM::GroupInstancePath > &aNewSelectedObjects, bool bSelectAll)
 Checks whether all the objects in the given vector are compatible with the selection action (i.e. More...
 
WSM_UTILS_EXPORT void DeleteObjectsIncludeSmoothAttachments (size_t nHistoryID, const 1::vector< size_t > &toDelete)
 This is the delete method for a formIt selection set. More...
 
WSM_UTILS_EXPORT void ConvertToTopLevel (size_t nHistoryID, size_t &nObjectID, bool bAllowInstances, bool bAllowOwnedFaces)
 Converts a single entity to its top level parent, except does not convert instances/faces to their owning groups/bodies if bAllowInstances/bAllowOwnedFaces is true. More...
 
WSM_UTILS_EXPORT void ConvertToTopLevel (WSM::GroupInstancePath &path, bool bAllowInstances, bool bAllowOwnedFaces)
 Converts a single entity to its top level parent, except does not convert instances/faces to their owning groups/bodies if bAllowInstances/bAllowOwnedFaces is true. More...
 
WSM_UTILS_EXPORT void ConvertToTopLevel (size_t nHistoryID, 1::vector< size_t > &aIDs, bool bAllowInstances, bool bAllowOwnedFaces)
 Converts a vector of entities to their top level parents and then removes duplicates. More...
 
WSM_UTILS_EXPORT void ConvertToTopLevel (1::vector< WSM::GroupInstancePath > &aPaths, bool bAllowInstances, bool bAllowOwnedFaces)
 Converts a vector of entities to their top level parents and then removes duplicates. More...
 
WSM_UTILS_EXPORT void ConvertToFaces (1::vector< WSM::GroupInstancePath > &aPaths)
 Converts a vector of entities to all faces. More...
 
WSM_UTILS_EXPORT void MakePathsHaveUniqueTopology (1::set< WSM::GroupInstancePath > &aPaths)
 Removes topological duplicates making each object unique and does not contain any child topology in the set. More...
 
WSM_UTILS_EXPORT bool IsOnCurveJunction (size_t nHistoryID, size_t nVertexID, bool bInferencing=true)
 Check to see if we have a junction vertex where the number of non smooth edges is equal to two for inferencing or greater than 2 for all other cases. More...
 
WSM_UTILS_EXPORT void GetGroupInstanceNonOwnedGeometricObjects (const GroupInstancePath &instance, 1::vector< GroupInstancePath > &nonOwnedObjects)
 For a group instance, get all top level objects (edges, faces, bodies) in the referenced history. More...
 
WSM_UTILS_EXPORT void GetMemoryInfo (size_t nHistoryID, 1::vector< size_t > &aRefdHistoryIDs, size_t &nFullSize, size_t &nCollapsedSize)
 Get the size of the memory occupied by all Histories, including referenced ones. More...
 
WSM_UTILS_EXPORT::vector< WSM::Point3dGetImageCorners (size_t nHistoryId, size_t nImageId)
 Get the four corner points of an image object. More...
 
WSM_UTILS_EXPORT bool MultipleDeltasInHistoryOrSubHistories (size_t nHistoryID)
 Returns true if nHistoryID or any of the referenced sub-Histories from nHistoryID have multiple Deltas. More...
 
WSM_UTILS_EXPORT size_t GetReferenceHistoryID (1::map< 1::string, size_t > &mapFileNameToID, const 1::string &filename)
 if the history reference ID is bad or it has been changed ,return an invalid reference ID, telling the contentlibarywidget to load a new file More...
 
WSM_UTILS_EXPORT WSM::Interval3d GetAxisAlignedBoundingBox (const 1::vector< WSM::GroupInstancePath > &aPaths, WSM::Utils::CoordSystem CS)
 Calculates the bounding box of the given objects in the given WSM::Utils::CoordSystem. More...
 
WSM_UTILS_EXPORT WSM::Point3d SnapScalePoint (const WSM::Point3d &inPoint, const WSM::Line3d &scaleAxis)
 Adjust the input point so that its distance along the given line represents a scale factor that is a whole number (in percent). More...
 
WSM_UTILS_EXPORT bool SetOrCreateStringAttributeForObject (size_t nHistoryID, size_t nObjectID, const 1::string &key, const 1::string &value, WSM::nCopyBehavior nCB=WSM::nCopyBehavior::nShareOrCopy, bool bIsSharedOnSplit=true)
 Sets the value of a string attribute of a given object, if that object has such an attribute with the given key. More...
 
WSM_UTILS_EXPORT double DegreesToRadians (double degrees)
 Convert degrees to radians. More...
 
WSM_UTILS_EXPORT double RadiansToDegrees (double radians)
 Convert radians to degrees. More...
 
WSM_UTILS_EXPORT PickRayPlaneIntersection GetPickrayIntersectionWithWorkPlane (const WSM::Utils::PickRay &pickRay, WSM::Point3d &intersectPt, WSM::Plane *intersectionPlane=nullptr)
 Get the intersection of a pickray with the current work plane or ground plane It also creates some default point if the intersection with the plane fails to be in front of the pick ray origin (i.e. More...
 
WSM_UTILS_EXPORT void ComputeUVsForMeshData (const MeshData &md, double dUScale, double dVScale, 1::vector< float > &aUVs)
 Helper function that computes mesh UV data. More...
 
WSM_UTILS_EXPORT void GetAllRenderingInformation (size_t nHistID, 1::vector< MeshesAndTransformsData > &aMeshesAndTransformsDataVec, 1::vector< MaterialData > &aMaterialVec)
 GetAllRenderingInformation() function. More...
 
WSM_UTILS_EXPORT bool IsObjecHiddenFunc (const WSM::GroupInstancePath &path, const WSM::Utils::PickRay &pickray, double dParam)
 IsObjecHiddenFunc() function. More...
 
WSM_UTILS_EXPORT bool IsOwnerOf (const WSM::GroupInstancePath &parent, const WSM::GroupInstancePath &child)
 Checks whether parent is an owner of child. More...
 

Variables

class WSM_UTILS_EXPORT PickRay
 

Typedef Documentation

using WSM::Utils::ObjectIDsAndPickPoints = typedef 1::vector<1::pair<size_t, WSM::Point3d>>

The selection related functions below that do not take a history ID obtain an IToolAppHelper from the InferenceEngine and use its interface functions to determine the history and in-context editing settings to use.

using WSM::Utils::ObjectsAndPickPoints = typedef 1::vector<1::pair<GroupInstancePath, WSM::Point3d>>

Enumeration Type Documentation

Enumerator
HCS 

The History being edited coordinate system.

LCS 

The History being edited local coordinate system.

WHCS 

The World History coordinate system.

WLCS 

The World History local coordinate system.

enum WSM::Utils::CurveType
strong
Enumerator
Unknown 
Line 
Circle 
Spline 
Enumerator
NONE 
ExcludeImages 
ExcludeSectionPlanes 

enum for return value of GetPickrayIntersectionWithWorkPlane

Enumerator
WorkPlane 

intersection is with the current work plane

GroundPlane 

intersection with the current work plane failed and is with

CameraPlane 

the ground (which is different from the work plane)

intersection with the ground failed and is with a plane perpendicular to the camera direction and

SelectionLevel is used as input to ExpandSelection to control how the given Object is expanded out to additional Objects.

Enumerator
BreakAtJunctionNonSmooth 

For Edges, connections stop when it finds a vertex with 3 or.

BreakAtJunction 

more non-smooth edges or a non-smooth vertex.

Face, it checks if it's a cylinder||Sphere||Extrude, it expands to all the Faces in the cylinder||Sphere||Extrude. For Edges, connections stop when it finds a vertex with 3 or

ConnectedFacesVariant 

more non-smooth edges.

Faces are expanded using common variants.

ConnectedFacesComponents 

Faces are expanded using convexity components.

ConnectedFacesVariantComponents 

Faces are expanded using variant then convexity components.

AllConnected 
Enumerator
Unknown 
Plane 
Cylinder 
Sphere 
Extrude 
Blend 
Enumerator
TOOLTIP 

Normal tooltip popup.

STATUS 

Status information for a tool.

Could go in status bar on Desktop or a tooltip on touch

NONE 

Add types before this line.

Function Documentation

WSM_UTILS_EXPORT double WSM::Utils::AngleFullCircleInRadians ( const WSM::UnitVector3d normal,
const WSM::Vector3d vecA,
const WSM::Vector3d vecB,
bool  returnPositive = false 
)

Calculates the radian angle counterclockwise from vector A to B on the plane with normal 'normal' If returnPositive, returns [0, 2PI) If not returnPositive, returns (-PI,PI].

Parameters
[in]normalThe given normal unit vector
[in]vecA
[in]vecB
[in]returnPositive
WSM_UTILS_EXPORT void WSM::Utils::AppendSelectionToGroupInstancePathArray ( 1::vector< size_t > const &  aInput,
1::vector< GroupInstancePath > &  aOutput 
)

Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper.

Parameters
[in]aInput
[out]aOutput
WSM_UTILS_EXPORT void WSM::Utils::AppendSelectionToGroupInstancePathArray ( 1::vector< ObjectHistoryID > const &  aInput,
1::vector< GroupInstancePath > &  aOutput 
)

Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper.

WSM_UTILS_EXPORT bool WSM::Utils::ComputeFaceCentroid ( size_t  historyID,
size_t  faceID,
WSM::Point3d centroid 
)

ComputeFaceCentroid returns the centroid (average of all points) of the given face.

Parameters
[in]historyID
[in]faceID
[out]centroid
WSM_UTILS_EXPORT bool WSM::Utils::ComputeFaceNormal ( size_t  historyID,
size_t  faceID,
WSM::UnitVector3d faceNormal 
)

ComputeFaceNormal returns the face normal of the given face.

Parameters
[in]historyID
[in]faceID
[out]faceNormal
WSM_UTILS_EXPORT void WSM::Utils::ComputeUVsForMeshData ( const MeshData md,
double  dUScale,
double  dVScale,
1::vector< float > &  aUVs 
)

Helper function that computes mesh UV data.

Note the UVs are specific to different dUScale and dVScale. This data must be computed per material and mesh pairs.

Parameters
[in]md
[in]dUScale
[in]dVScale
[out]aUVs
WSM_UTILS_EXPORT void WSM::Utils::ConvertToFaces ( 1::vector< WSM::GroupInstancePath > &  aPaths)

Converts a vector of entities to all faces.

Existing faces are kept. Bodies are converted to their faces. All other types are eliminated. Also removes duplicates.

Parameters
[out]aPaths
WSM_UTILS_EXPORT void WSM::Utils::ConvertToTopLevel ( size_t  nHistoryID,
size_t &  nObjectID,
bool  bAllowInstances,
bool  bAllowOwnedFaces 
)

Converts a single entity to its top level parent, except does not convert instances/faces to their owning groups/bodies if bAllowInstances/bAllowOwnedFaces is true.

Parameters
[in]nHistoryIDID of the given History
[out]nObjectIDID of the created Object
[in]bAllowInstances
[in]bAllowOwnedFaces
WSM_UTILS_EXPORT void WSM::Utils::ConvertToTopLevel ( WSM::GroupInstancePath path,
bool  bAllowInstances,
bool  bAllowOwnedFaces 
)

Converts a single entity to its top level parent, except does not convert instances/faces to their owning groups/bodies if bAllowInstances/bAllowOwnedFaces is true.

WSM_UTILS_EXPORT void WSM::Utils::ConvertToTopLevel ( size_t  nHistoryID,
1::vector< size_t > &  aIDs,
bool  bAllowInstances,
bool  bAllowOwnedFaces 
)

Converts a vector of entities to their top level parents and then removes duplicates.

WSM_UTILS_EXPORT void WSM::Utils::ConvertToTopLevel ( 1::vector< WSM::GroupInstancePath > &  aPaths,
bool  bAllowInstances,
bool  bAllowOwnedFaces 
)

Converts a vector of entities to their top level parents and then removes duplicates.

WSM_UTILS_EXPORT double WSM::Utils::DegreesToRadians ( double  degrees)
inline

Convert degrees to radians.

Parameters
[in]degrees
WSM_EXPORT bool WSM::Utils::DeleteHiddenObjects ( const size_t  nTopHistoryID)

Function that deletes hidden objects in nTopHistoryID and all histories reachable from it.

Parameters
[in]nTopHistoryIDID of the given History
WSM_EXPORT bool WSM::Utils::DeleteObjectsForEnergyAnaysis ( const size_t  nTopHistoryID)

Function that deletes objects that are hidden or not a mass category for energy analysis in nTopHistoryID and all histories reachable from it.

Parameters
[in]nTopHistoryIDID of the given History
WSM_UTILS_EXPORT void WSM::Utils::DeleteObjectsIncludeSmoothAttachments ( size_t  nHistoryID,
const 1::vector< size_t > &  toDelete 
)

This is the delete method for a formIt selection set.

When deleting a collection of smooth faces, delete all internal smooth edges as well. When deleting an edge, make sure that if an adjacent smooth face would be deleted, propagate that to the entire smooth face surface and internal smooth edges

Parameters
[in]nHistoryIDID of the given History
[in]toDelete
constexpr bool WSM::Utils::enable_bitmask_operators ( ObjectTypes  )
WSM_UTILS_EXPORT bool WSM::Utils::ExpandSelection ( size_t  nHistoryID,
size_t  objectID,
1::vector< size_t > &  expandedSelection,
SelectionLevel  selectionlevel,
ObjectTypeFilter const *  pFilter,
bool  bCanExpandInstances,
WSM::Utils::PickRay const *  pPickRay = nullptr 
)

ExpandSelection expands the selection starting with objectID.

Expansion is controlled by SelectionLevel. If bCanExpandInstances is true and expandedSelection is AllConnected, then any instances will be expanded to all instances of the same history. Otherwise, instances are left unmodified. The pick ray is populated by selection and is used to identify which face loop of an edge to expand Results are returned in expandedSelection. Returns success.

Parameters
[in]nHistoryIDID of the given History
[in]objectID
[out]expandedSelection
[in]selectionlevel
[in]pFilter
[in]bCanExpandInstances
[in]pPickRay
WSM_UTILS_EXPORT bool WSM::Utils::ExpandSelection ( WSM::GroupInstancePath const &  objectID,
1::vector< WSM::GroupInstancePath > &  expandedSelection,
SelectionLevel  selectionlevel,
ObjectTypeFilter const *  pFilter,
bool  bCanExpandInstances,
WSM::Utils::PickRay const *  pPickRay = nullptr 
)
WSM_UTILS_EXPORT ::vector<size_t> WSM::Utils::GetAllNonOwnedGeometricObjects ( size_t  nHistoryID)

Returns all non owned Objects of geometric type (Body, Face or Edge) in the given History.

Parameters
[in]nHistoryIDID of the given History
WSM_UTILS_EXPORT void WSM::Utils::GetAllRenderingInformation ( size_t  nHistID,
1::vector< MeshesAndTransformsData > &  aMeshesAndTransformsDataVec,
1::vector< MaterialData > &  aMaterialVec 
)

GetAllRenderingInformation() function.

Parameters
[in]nHistID
[out]aMeshesAndTransformsDataVec
[out]aMaterialVec
WSM_UTILS_EXPORT IAppHelper* WSM::Utils::GetAppHelper ( )

Get the currently registered IAppHelper object.

WSM_UTILS_EXPORT WSM::Interval3d WSM::Utils::GetAxisAlignedBoundingBox ( const 1::vector< WSM::GroupInstancePath > &  aPaths,
WSM::Utils::CoordSystem  CS 
)

Calculates the bounding box of the given objects in the given WSM::Utils::CoordSystem.

Parameters
[in]aPaths
[in]CS
WSM_UTILS_EXPORT bool WSM::Utils::GetCoedgePoints ( size_t  nHistoryID,
size_t  coedgeID,
WSM::Point3d begin,
WSM::Point3d end 
)

GetCoedgePoints returns the begin/end points of coedge.

Parameters
[in]nHistoryIDID of the given History
[in]coedgeID
[out]begin
[out]end
WSM_UTILS_EXPORT CurveType WSM::Utils::GetEdgeCurveType ( size_t  nHistoryID,
size_t  edgeId,
size_t *  pAttribID = nullptr 
)

Returns Edge curve type in curveType and also returns the curve attribute ID if attribID != nullptr.

Parameters
[in]nHistoryIDID of the given History
[in]edgeId
[out]pAttribID
WSM_UTILS_EXPORT size_t WSM::Utils::GetEdgeIDFromCoedge ( size_t  nHistoryID,
size_t  coedgeID 
)

Get edge Id from the given coedge.

Parameters
[in]nHistoryIDID of the given History
[in]coedgeID
WSM_UTILS_EXPORT Line3d WSM::Utils::GetEdgeLine ( size_t  nHistoryID,
size_t  edge 
)

GetEdgeLine returns the line the 'edge' lies on.

If 'edge' is is not an Edge, a default Line3d is returned.

Parameters
[in]nHistoryIDID of the given History
[in]edge
WSM_UTILS_EXPORT size_t WSM::Utils::GetFaceIDFromCoedge ( size_t  nHistoryID,
size_t  coedgeID 
)

Get face id from the given coedge.

Parameters
[in]nHistoryIDID of the given History
[in]coedgeID
WSM_UTILS_EXPORT bool WSM::Utils::GetFacePoints ( const GroupInstancePath facePath,
1::vector< WSM::Point3d > &  aPoints 
)

Get all points of a face.

The points are transformed into world space if the face is from a group instance

Parameters
[in]facePath
[out]aPointsThe created vector of points
WSM_UTILS_EXPORT SurfaceType WSM::Utils::GetFaceSurfaceType ( size_t  nHistoryID,
size_t  edgeId,
size_t *  pAttribID = nullptr 
)

Returns Face surface type in surfaceType and also returns the surface attribute ID if attribID != nullptr.

Parameters
[in]nHistoryIDID of the given History
[in]edgeId
[out]pAttribID
WSM_UTILS_EXPORT void WSM::Utils::GetGroupInstanceNonOwnedGeometricObjects ( const GroupInstancePath instance,
1::vector< GroupInstancePath > &  nonOwnedObjects 
)

For a group instance, get all top level objects (edges, faces, bodies) in the referenced history.

Recurses for all nested instances.

Parameters
[in]instance
[out]nonOwnedObjects
WSM_UTILS_EXPORT ::vector<WSM::Point3d> WSM::Utils::GetImageCorners ( size_t  nHistoryId,
size_t  nImageId 
)

Get the four corner points of an image object.

If the object passed in is not an image, no points are returned

Parameters
[in]nHistoryIdID of the given History
[in]nImageId
WSM_UTILS_EXPORT void WSM::Utils::GetMemoryInfo ( size_t  nHistoryID,
1::vector< size_t > &  aRefdHistoryIDs,
size_t &  nFullSize,
size_t &  nCollapsedSize 
)

Get the size of the memory occupied by all Histories, including referenced ones.

The function returns the total memory size as well as the vector of referenced History IDs from nHistoryID down. If nHistoryID is invalid, returns 0 (since even an empty History has s small non-zero memory footprint).

Parameters
[in]nHistoryIDID of the given History
[out]aRefdHistoryIDs
[out]nFullSize
[out]nCollapsedSize
WSM_UTILS_EXPORT PickRayPlaneIntersection WSM::Utils::GetPickrayIntersectionWithWorkPlane ( const WSM::Utils::PickRay pickRay,
WSM::Point3d intersectPt,
WSM::Plane intersectionPlane = nullptr 
)

Get the intersection of a pickray with the current work plane or ground plane It also creates some default point if the intersection with the plane fails to be in front of the pick ray origin (i.e.

the camera). This method will always succeed to create a meaningful point. Returns PickRayPlaneIntersection enum The optional intersectionPlane returns the plane actually used

Parameters
[in]pickRay
[out]intersectPt
[out]intersectionPlane
WSM_UTILS_EXPORT void WSM::Utils::GetPointsOnEdgeCurve ( size_t  nHistoryID,
size_t  edgeId,
const 1::vector< double > &  params,
1::vector< WSM::Point3d > &  points 
)

Get points on the curve of an edge.

If the edge id passed in is part of a circle or spline, the points are caclulated for all edges of the curve. The params vector passed in contains the normalized parameter values for the points along the curve. All curves are assumed to have a parameter space range of 0 to 1 Note, that the points are located on the edges of the curve, not on the true curve. For speed purpose (used by inferencing) this method uses a cache, where the precalculated values for the last used edges are stored and re-used. if subsequent calls use the same edges in the same history in the same delta, this cache is used. Otherwise it is regenerated.

Parameters
[in]nHistoryIDID of the given History
[in]edgeId
[in]params
[out]points
WSM_UTILS_EXPORT size_t WSM::Utils::GetReferenceHistoryID ( 1::map< 1::string, size_t > &  mapFileNameToID,
const 1::string &  filename 
)

if the history reference ID is bad or it has been changed ,return an invalid reference ID, telling the contentlibarywidget to load a new file

Parameters
[out]mapFileNameToID
[in]filename
WSM_EXPORT bool WSM::Utils::GetStringAttributeForObject ( size_t  nHistoryID,
size_t  nObjectID,
const 1::string &  key,
1::string &  value 
)

Gets the string attribute value for a given object and key.

If Object ID is WSM::INVALID_ID, the attribute is pulled from the History. Returns true if the object has a string attribute with that key. Returns false if not.

Parameters
[in]nHistoryIDID of the given History
[in]nObjectIDID of the given Object, can be WSM::INVALID_ID
[in]keyAttribute key for search
[out]valuevalue of the attribute when the search is successful.
WSM_UTILS_EXPORT bool WSM::Utils::GetVertexCurveAttributes ( size_t  historyID,
size_t  vertexID,
1::vector< 1::pair< size_t, size_t >> &  aAttributeIDs 
)

GetVertexCurveAttributes looks at all the Edges hanging off the vertices and returns a vector of pairs (EdgeID, AttributeID) (aAttributeIDs) that have a curve attribute.

Parameters
[in]historyID
[in]vertexID
[out]aAttributeIDs
WSM_UTILS_EXPORT bool WSM::Utils::HasSmoothEdge ( size_t  nHistoryID,
size_t  objectID 
)

Returns whether the provided object has any smooth edges.

Returns false in the case of bad input Returns true only if the object is a smooth edge or has a child that is a smooth edge

Parameters
[in]nHistoryIDID of the given History
[in]objectID
WSM_UTILS_EXPORT bool WSM::Utils::IsBackFace ( const WSM::GroupInstancePath face,
const Point3d cameraPos,
const Vector3d cameraDir,
bool  perspectiveView 
)

Check whether the given face is pointing away from the camera i.e.

cannot be "seen" from the camera

Parameters
[in]face
[in]cameraPos
[in]cameraDir
[in]perspectiveView
WSM_UTILS_EXPORT bool WSM::Utils::IsFreeEdge ( size_t  nHistoryID,
size_t  edgeId 
)

Determines if given edge is an edge that is not between two faces ("free").

This can either be a freestanding edge, or an edge that borders only one face

Parameters
[in]nHistoryIDID of the given History
[in]edgeId
WSM_UTILS_EXPORT bool WSM::Utils::IsLayerHidden ( size_t  nHistoryID,
size_t  id 
)

Takes a WSM 'id' and returns true if the layer is hidden.

Parameters
[in]nHistoryIDID of the given History
[in]id
WSM_UTILS_EXPORT bool WSM::Utils::IsLayerNotPickable ( size_t  nHistoryID,
size_t  id 
)

Takes a WSM 'id' and returns true if the layer is not pickable.

Parameters
[in]nHistoryIDID of the given History
[in]id
WSM_UTILS_EXPORT bool WSM::Utils::IsObjecHiddenFunc ( const WSM::GroupInstancePath path,
const WSM::Utils::PickRay pickray,
double  dParam 
)

IsObjecHiddenFunc() function.

Parameters
[in]path
[in]pickray
[in]dParam
WSM_UTILS_EXPORT bool WSM::Utils::IsObjectHidden ( size_t  nHistoryID,
size_t  id 
)

Takes a WSM 'id' and returns true if the object is on a hidden layer.

Parameters
[in]nHistoryIDID of the given History
[in]id
WSM_UTILS_EXPORT bool WSM::Utils::IsObjectHiddenByPath ( GroupInstancePath const &  groupInstancePath)

Takes a WSM path and returns true if the object is on a hidden layer.

Unlike IsObjectHidden, this method takes the whole path into account and checks whether group edit mode is active and the object is not in the edit path. If so and the option to hide non edited obejcts is on, the object is hidden.

Parameters
[in]groupInstancePath
WSM_UTILS_EXPORT bool WSM::Utils::IsObjectNotPickable ( size_t  nHistoryID,
size_t  id 
)

Takes a WSM 'id' and returns true if the object is on a non pickable layer.

Parameters
[in]nHistoryIDID of the given History
[in]id
WSM_UTILS_EXPORT bool WSM::Utils::IsObjectNotPickableByPath ( GroupInstancePath const &  groupInstancePath)

Takes a WSM 'id' and returns true if the object is on a non pickable layer.

Parameters
[in]groupInstancePath
WSM_UTILS_EXPORT bool WSM::Utils::IsObjectType ( size_t  nHistoryID,
size_t  id,
nObjectType  type 
)

IsObjectType takes a WSM 'id' and returns true if the object (id) is of the given 'type'.

Parameters
[in]nHistoryIDID of the given History
[in]id
[in]type
WSM_UTILS_EXPORT bool WSM::Utils::IsObjectType ( size_t  nHistoryID,
size_t  id,
1::vector< nObjectType > const &  aTypes 
)

IsObjectType takes a WSM 'id' and returns true if the object (id) is of any of the given 'types'.

WSM_UTILS_EXPORT bool WSM::Utils::IsOnCurveJunction ( size_t  nHistoryID,
size_t  nVertexID,
bool  bInferencing = true 
)

Check to see if we have a junction vertex where the number of non smooth edges is equal to two for inferencing or greater than 2 for all other cases.

Parameters
[in]nHistoryIDID of the given History
[in]nVertexID
[in]bInferencing
WSM_UTILS_EXPORT bool WSM::Utils::IsOwnerOf ( const WSM::GroupInstancePath parent,
const WSM::GroupInstancePath child 
)

Checks whether parent is an owner of child.

Parameters
[in]parent
[in]child
WSM_EXPORT bool WSM::Utils::IsSectionPlane ( size_t  nHistoryID,
size_t  nObjectID 
)

Returns true if an instance or group's reference history is a section plane.

If nObjectID is WSM::INVALID_ID or not for a group or instance, the history is checked directly.

Parameters
[in]nHistoryIDID of the given History
[in]nObjectIDID of the given Object, can be WSM::INVALID_ID
WSM_UTILS_EXPORT bool WSM::Utils::IsSelectAllConnected ( size_t  nHistoryID,
const 1::vector< size_t > &  selectedObjectIDs 
)

Checks whether all the objects in the given vector are the result of select connected action (i.e.

double click/tap). Thus returns true if :

  • All objects are top level or otherwise not connected to anything else
  • All objects which are "expanded" from a given top level are also selected. This is what happens in the double click/tap case.
    Parameters
    [in]nHistoryIDID of the given History
    [in]selectedObjectIDs
WSM_UTILS_EXPORT bool WSM::Utils::IsSelectAllConnected ( const 1::vector< WSM::GroupInstancePath > &  selectedObjectPaths)

Checks whether all the objects in the given vector are the result of select connected action (i.e.

double click/tap). Thus returns true if :

  • All objects are top level or otherwise not connected to anything else
  • All objects which are "expanded" from a given top level are also selected. This is what happens in the double click/tap case.
WSM_UTILS_EXPORT bool WSM::Utils::IsSilhouetteEdge ( size_t  nHistoryID,
size_t  edgeId,
const Point3d cameraPos,
const Vector3d cameraDir,
bool  perspectiveView 
)

Determines if given edge is silhouette.

Parameters
[in]nHistoryIDID of the given History
[in]edgeId
[in]cameraPos
[in]cameraDir
[in]perspectiveView
WSM_UTILS_EXPORT bool WSM::Utils::IsSmooth ( size_t  nHistoryID,
size_t  objectID 
)

Returns whether an edge or vertex is marked as smooth.

A 'false' result may mean either that the object is non-smooth or its smoothness is unknown. Also returns 'false' if objectID == WSM::INVALID_ID. Note, this is a read only operation.

Parameters
[in]nHistoryIDID of the given History
[in]objectID
WSM_UTILS_EXPORT bool WSM::Utils::IsTopLevelObjectHidden ( size_t  nHistoryID,
size_t  id 
)

Takes a WSM 'id' and returns true if the object's top level owner is on a hidden layer.

Parameters
[in]nHistoryIDID of the given History
[in]id
WSM_UTILS_EXPORT bool WSM::Utils::IsTopLevelObjectHiddenByPath ( GroupInstancePath const &  groupInstancePath)

Takes a WSM path and returns true if the top level owner of any object in the path is on a hidden layer.

Unlike IsTopLevelObjectHidden, this method takes the whole path into account and checks whether group edit mode is active and the object is not in the edit path. If so and the option to hide non edited obejcts is on, the object is hidden.

Parameters
[in]groupInstancePath
WSM_UTILS_EXPORT bool WSM::Utils::IsTopLevelObjectNotPickable ( size_t  nHistoryID,
size_t  id 
)

Takes a WSM 'id' and returns true if the object's top level owner is on a non pickable layer.

Parameters
[in]nHistoryIDID of the given History
[in]id
WSM_UTILS_EXPORT bool WSM::Utils::IsTopLevelObjectNotPickableByPath ( GroupInstancePath const &  groupInstancePath)

Takes a WSM path and returns true if the top level owner of the final object in the path is on a not pickable layer.

Parameters
[in]groupInstancePath
WSM_UTILS_EXPORT bool WSM::Utils::IsVertexEditable ( size_t  historyID,
size_t  vertexID 
)

Returns whether a vertex is editable.

A 'true' result means !IsSmooth && !IsVertexOnCurve. Returns 'false' if vertexID is not a Vertex. Note that it is a read only operation.

Parameters
[in]historyID
[in]vertexID
WSM_UTILS_EXPORT bool WSM::Utils::IsVertexOnCurve ( size_t  historyID,
size_t  vertexID 
)

Returns whether a vertex is on an arc or hermite spline curve.

A 'true' result means there is an edge attached to the vertex which are located on an arc/circle or spline. Note that it is a read only operation.

Parameters
[in]historyID
[in]vertexID
WSM_UTILS_EXPORT void WSM::Utils::MakePathsHaveUniqueTopology ( 1::set< WSM::GroupInstancePath > &  aPaths)

Removes topological duplicates making each object unique and does not contain any child topology in the set.

As an example if you have a body and an edge in the same body in the list the edge would be removed. This is so that the move object function will not move the edge twice.

Parameters
[out]aPaths
WSM_UTILS_EXPORT bool WSM::Utils::MatchesSelectionType ( const 1::vector< WSM::GroupInstancePath > &  selectedObjectIDs,
const 1::vector< WSM::GroupInstancePath > &  aNewSelectedObjects,
bool  bSelectAll 
)

Checks whether all the objects in the given vector are compatible with the selection action (i.e.

double click/tap). Instances in the selection are ignored. Thus returns true if :

  • All objects are top level or otherwise not connected to anything else
  • All objects which are "expanded" from a given top level are also selected. This is what happens in the double click/tap case.
    Parameters
    [in]selectedObjectIDs
    [in]aNewSelectedObjects
    [in]bSelectAll
WSM_UTILS_EXPORT bool WSM::Utils::MultipleDeltasInHistoryOrSubHistories ( size_t  nHistoryID)

Returns true if nHistoryID or any of the referenced sub-Histories from nHistoryID have multiple Deltas.

This is used to test if any of the related Histories have been changed.

Parameters
[in]nHistoryIDID of the given History
WSM_UTILS_EXPORT bool WSM::Utils::ObjectCanBeHidden ( size_t  nHistoryID,
size_t  nObjectID 
)

Can this object be hidden directly? This means that it's non-owned or an instance.

Parameters
[in]nHistoryIDID of the given History
[in]nObjectIDID of the given object
WSM_UTILS_EXPORT bool WSM::Utils::ObjectCanBeNotPickable ( size_t  nHistoryID,
size_t  nObjectID 
)

Can this object be not pickable directly? This means that it's non-owned or an instance.

Parameters
[in]nHistoryIDID of the given History
[in]nObjectIDID of the given object
WSM_UTILS_EXPORT size_t WSM::Utils::PickBody ( const PickRay pickRay)

PickBody returns the id of the body picked by pickRay.

Parameters
[in]pickRay
WSM_UTILS_EXPORT size_t WSM::Utils::PickGeometry ( const PickRay originalPickray,
const ObjectTypeFilter filter,
bool  bAllowAdjustRayRadius = true 
)

PickGeometry is exactly the same as PickObjectsWithRay except that it returns the first result instead of an array of objects and pick points.

Parameters
[in]originalPickray
[in]filter
[in]bAllowAdjustRayRadius
WSM_UTILS_EXPORT void WSM::Utils::PickObjectsWithFilter ( const PickRay pickray,
const ObjectTypeFilter filter,
SelectionLevel  currentSelectionLevel,
WSM::GroupInstancePath firstSelectedObject,
1::vector< WSM::GroupInstancePath > &  allSelectedObjects,
ObjectsAndPickPoints aObjectsAndPickPoints,
bool  bCullAgainstSectionPlanes = false 
)

Common picking code for non-window.

Uses filter, a pickray and a selection level, fills allSelectedObjects with the result. Also returned is the front pick in the selection (starting point for tabbing through selection) NOTE: It is possible that firstSelectedObject is not in allSelectedObjects if ObjectTypeFilter has mustBeTopLevel set to true.

Parameters
[in]pickray
[in]filter
[in]currentSelectionLevel
[out]firstSelectedObject
[out]allSelectedObjects
[out]aObjectsAndPickPoints
[in]bCullAgainstSectionPlanes
WSM_UTILS_EXPORT WSM::Result WSM::Utils::PickObjectsWithRay ( PickRay const &  pickRay,
const ObjectTypeFilter filter,
bool  bAllowAdjustRayRadius,
bool  bIgnoreInContext,
ObjectIDsAndPickPoints aObjectsAndPickPoints,
bool  bCullAgainstSectionPlanes = false 
)

PickObjectsWithRay returns all objects that can be picked via the given pick ray, which is all objects up to the first face, as the face obscures everything behind it from picking.

The filter determines what kind of topology is picked.

If bAllowAdjustRayRadius is true, we are going to calculate a theoretical radius based on the first picked face and the circle equation and the area and circumference of a circle.

If bIgnoreInContext is true, always pick from the main history

The result is returned as a sorted array of object - pick point (point on the object by which it was picked) pairs.

Parameters
[in]pickRay
[in]filter
[in]bAllowAdjustRayRadius
[in]bIgnoreInContext
[out]aObjectsAndPickPoints
[in]bCullAgainstSectionPlanes
WSM_UTILS_EXPORT WSM::Result WSM::Utils::PickObjectsWithRay ( PickRay  pickRay,
const ObjectTypeFilter filter,
bool  bAllowAdjustRayRadius,
bool  bAllowGroupGeometry,
bool  bRestrictGroupGeometryToEditingPath,
bool  bIgnoreInContext,
ObjectsAndPickPoints aObjectsAndPickPoints,
bool  bCullAgainstSectionPlanes = false 
)

PickObjectsWithRay returns all objects that can be picked via the given pick ray, which is all objects up to the first face, as the face obscures everything behind it from picking.

The filter determines what kind of topology is picked.

If bAllowAdjustRayRadius is true, we are going to calculate a theoretical radius based on the first picked face and the circle equation and the area and circumference of a circle.

If bIgnoreInContext is true, always pick from the main history

The result is returned as a sorted array of object - pick point (point on the object by which it was picked) pairs.

WSM_UTILS_EXPORT double WSM::Utils::RadiansToDegrees ( double  radians)
inline

Convert radians to degrees.

Parameters
[in]radians
WSM_UTILS_EXPORT bool WSM::Utils::RayFireWithObjects ( const 1::set< size_t > &  objectIds,
const PickRay ray,
WSM::Point3d pickPointOnObject 
)

Core ray fire function that tests ray intersection against a given set of objects.

if rayRadius is larger than WSM_DISTANCE_TOL, a picking tolerance is assumed and bodies are picked by edge and face. If rayRadius is less, an exact pick is performed and bodies are only picked by faces.

Parameters
[in]objectIds
[in]ray
[out]pickPointOnObject
WSM_UTILS_EXPORT void WSM::Utils::RegisterAppHelper ( 1::unique_ptr< IAppHelper pAppHelper)

Register a concrete instance of the IAppHelper interface.

This is needed for these APIs to operate.

Parameters
[in]pAppHelper
WSM_UTILS_EXPORT void WSM::Utils::RemoveHiddenObjects ( size_t  nHistoryID,
1::vector< size_t > const &  aObjectIDs,
1::vector< WSM::GroupInstancePath > const &  aObjectsInGroupsVec,
1::vector< 1::pair< double, ptrdiff_t >> &  paramIndexVec,
const PickRay pickray,
bool  bCullAgainstSectionPlanes = false 
)

Removes objects on hidden layers from the data returned by the selection functions.

Only the paramIndexVec is affected.

Parameters
[in]nHistoryIDID of the given History
[in]aObjectIDs
[in]aObjectsInGroupsVec
[out]paramIndexVec
[in]pickray
[in]bCullAgainstSectionPlanes
WSM_UTILS_EXPORT void WSM::Utils::RemoveNonPickableObjects ( size_t  nHistoryID,
1::vector< size_t > const &  aObjectIDs,
1::vector< WSM::GroupInstancePath > const &  aObjectsInGroupsVec,
1::vector< 1::pair< double, ptrdiff_t >> &  paramIndexVec 
)

Removes objects on non pickabke layers from the data returned by the selection functions.

Only modifies paramIndexVec.

Parameters
[in]nHistoryIDID of the given History
[in]aObjectIDs
[in]aObjectsInGroupsVec
[out]paramIndexVec
WSM_UTILS_EXPORT void WSM::Utils::RemoveNonPickableObjects ( size_t  nHistoryID,
1::vector< size_t > &  aObjectIDs,
1::vector< WSM::GroupInstancePath > &  aObjectsInGroupsVec,
1::vector< WSM::Transf3d > &  aGroupAggregateTransf3dVec 
)

Removes objects on non pickable layers from the data returned by the selection functions.

This method modifies all the vectors passed in.

WSM_UTILS_EXPORT void WSM::Utils::SelectionFromGroupInstancePathArray ( 1::vector< size_t > &  aOutput,
1::vector< GroupInstancePath > const &  aInput 
)

Takes a vector of GroupInstancePath objects, and populates the vector with the IDs of those compatible with the in-context editing settings from IToolAppHelper.

Parameters
[out]aOutput
[in]aInput
WSM_UTILS_EXPORT GroupInstancePath WSM::Utils::SelectionToGroupInstancePath ( size_t  aObjectID)

Takes an object ID value, and return a GroupInstancePath with that data and the current in-context editing settings from IToolAppHelper.

Parameters
[in]aObjectID
WSM_UTILS_EXPORT void WSM::Utils::SelectionToGroupInstancePathArray ( 1::vector< size_t > const &  aInput,
1::vector< GroupInstancePath > &  aOutput 
)

Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper.

Parameters
[in]aInput
[out]aOutput
WSM_UTILS_EXPORT void WSM::Utils::SelectionToGroupInstancePathArray ( 1::vector< ObjectHistoryID > const &  aInput,
1::vector< GroupInstancePath > &  aOutput 
)

Takes a vector of objects ID values, and populates the GroupInstancePath vector with that data and the current in-context editing settings from IToolAppHelper.

WSM_UTILS_EXPORT bool WSM::Utils::SetOrCreateStringAttributeForObject ( size_t  nHistoryID,
size_t  nObjectID,
const 1::string &  key,
const 1::string &  value,
WSM::nCopyBehavior  nCB = WSM::nCopyBehavior::nShareOrCopy,
bool  bIsSharedOnSplit = true 
)

Sets the value of a string attribute of a given object, if that object has such an attribute with the given key.

Otherwise it creates the attribute first. If the Object ID is WSM::INVALID_ID, the attribute is set on the History. The copy behavior and bIsSharedOnSplit flag are only used when the attribute is created. Returns true if successful, false otherwise.

Parameters
[in]nHistoryIDID of the given History
[in]nObjectIDID of the given object
[in]keyAttribute key for search
[in]value
[in]nCB
[in]bIsSharedOnSplit
WSM_UTILS_EXPORT bool WSM::Utils::SetToOwnerBody ( WSM::GroupInstancePath path)

Returns true if the path was changed to the object's owner body.

Parameters
[out]path
WSM_UTILS_EXPORT WSM::Point3d WSM::Utils::SnapScalePoint ( const WSM::Point3d inPoint,
const WSM::Line3d scaleAxis 
)

Adjust the input point so that its distance along the given line represents a scale factor that is a whole number (in percent).

This is used by the scale and faceScale tools

Parameters
[in]inPoint
[in]scaleAxis
WSM_UTILS_EXPORT size_t WSM::Utils::TestPickImages ( size_t  nHistoryID,
const 1::vector< size_t > &  imageIds,
const PickRay pickRay,
Point3d pickPointOnImage 
)

Try picking the given Images with a pick ray If hits an image, returns the id of the picked image and the 3d point that was picked.

Parameters
[in]nHistoryIDID of the given History
[in]imageIds
[in]pickRay
[out]pickPointOnImage
WSM_EXPORT bool WSM::Utils::UnnestOrExplodeNestedGroups ( const size_t  nTopHistoryID)

Helper function that gets rid of nested Groups.

If Group is based on a non-mass referenced History, Groups in the referenced History will be exploded, otherwise they will also be unnested to the top level. Materials on Instances with the deepest nesting will be kept. Empty Groups will be deleted. Returns true if successful. Note this was originally required for Revit but it is not used now although is might be needed again, in which case the behavior should be modified as needed.

Parameters
[in]nTopHistoryIDID of the given History
WSM_UTILS_EXPORT void WSM::Utils::UnregisterAppHelper ( )

Unregister the previously registered IAppHelper instance.

Variable Documentation