Space Usage Functions

The SpaceUsageFunctions package contains a set of functions for exposure and usage in knowledge tools.

This page discusses:

QuerySpaces

You can use this function to query the spaces containing a required product.

Signature

ProductOccurrence -> QuerySpaces(SpaceConceptRoot: SPP_SpaceConceptRoot,
			FilterVolumeMode: Integer,
			Clearance: Length,
			SpacePLMType: String,
			ExtensionPLMType: String,
			ListOfSpaces: out List): Boolean
LogicalOccurrence -> QuerySpaces(SpaceConceptRoot: SPP_SpaceConceptRoot,
			FilterVolumeMode: Integer,
			Clearance: Length,
			SpacePLMType: String,
			ExtensionPLMType: String,
			ListOfSpaces: out List): Boolean

Arguments

Name Input / Output Required? Type Comment
SpaceConceptRoot In Yes SPP_SpaceConceptRoot The spaces available under this space concept root are queried. If it is NULL, the spaces available under the space folder set in Data Setup, are queried.
ThisObjectOccurrence In Yes ProductOccurrence The occurrences of the product which intersects some space references.
filterVolumeMode In Yes Integer Mode of query:
  • 1 (Fully IN): Filters spaces which are fully inside the selected object.(Usually, space is bigger than the selected object. Hence, it is difficult to get a result with this mode.)
  • 2 (Fully OUT): Filters spaces which are fully outside the selected object.
  • 3 (Partly IN): Filters spaces which are across and fully inside the selected object.
  • 4 (Partly OUT): Filters spaces which are across and fully outside the selected object.
clearance In Yes Length It specifies the clearance distance around the input object.
spaceType In Yes String The name of the PLMType of the space to be filtered. For example, SSM_DesignSpaceRef.
ExtensionPLMType In Yes String Name of the PLMType of extension to be filtered.
ListOfPLMSpaceOccurences Out Yes List Output list of the space occurrences containing the given product based on the mode of query.

ReturnType

Boolean

TRUE if the query is successful, FALSE if not.

Example

let filterVolumeMode(Integer)
let clearance(LENGTH) 
let spaceType(String) 
let ExtensionPLMType(String) 
let ListOfPLMSpaceOccurences (List) 
let OccurenceSpaceQueryResult(PLMOccurrenceQueryResult)
let SpaceOccurrence(ProductOccurrence) 
let i(Integer) 
let result(Boolean) 
let spaceConceptRoot(SPP_SpaceConceptRoot)

filterVolumeMode =3
clearance=0m
i=1  
result = ThisObjectOccurrence.QuerySpaces(spaceConceptRoot,
             filterVolumeMode, 
             clearance,spaceType,  
             ExtensionPLMType,  
             ListOfPLMSpaceOccurences) 
if(result)
{    
	for i while i <= ListOfPLMSpaceOccurences.Size()   
	{        
		OccurenceSpaceQueryResult = ListOfPLMSpaceOccurences.GetItem(i)       
		if(OccurenceSpaceQueryResult <> NULL)       
		{                      
				attrValue=OccurenceSpaceQueryResult.GetAttributeString("PLM_ExternalID")
				Message(attrValue)	              
		}                       		    
	}
}

QuerySpaceByCuboid

You can use this function to query the spaces contained in a required cuboid.

Signature

QuerySpaces(MinX: Real,  MinY: Real, MinZ: Real, MaxX: Real, MaxY: Real, MaxZ: Real, 
SpaceConceptRoot: SPP_SpaceConceptRoot, FilterVolumeMode: Integer, SpacePLMType: String, 
ExtensionPLMType: String, ListOfSpaces: out List): Boolean

Arguments

Name Input / Output Required? Type Comment
MinX In Yes Real X of minimum of cuboid.
MinY In Yes Real Y of minimum of cuboid.
MinZ In Yes Real Z of minimum of cuboid.
MaxX In Yes Real X of maximum of cuboid
MaxY In Yes Real Y of maximum of cuboid
MaxZ In Yes Real Z of maximum of cuboid
SpaceConceptRoot In No SPP_SpaceConceptRoot The spaces available under this space concept root are queried. If it is NULL, the spaces available under the space folder set in Data Setup, are queried.
FilterVolumeMode In Yes Integer Mode of query:
  • 1 (Fully IN): Filters spaces which are fully inside the selected cuboid.
  • 2 (Fully OUT): Filters spaces which are fully outside the selected cuboid.
  • 3 (Partly IN): Filters spaces which are across and fully inside the selected cuboid.
  • 4 (Partly OUT): Filters spaces which are across and fully outside the selected cuboid.
SpacePLMType In No String The name of the PLMType of the space to be filtered. For example, SSM_DesignSpaceRef.
ExtensionPLMType In No String Name of the PLMType of extension to be filtered.
ListOfSpaces Out Yes List Output list of the space occurrences contained in the given cuboid based on the mode of query.

ReturnType

Boolean

TRUE if the query is successful, FALSE if not.

Example

let minX(Real)
let minY(Real)
let minZ(Real)
let maxX(Real)
let maxY(Real)
let maxZ(Real)
let spaceConceptRoot(SPP_SpaceConceptRoot)
let filterVolumeMode(Integer)
let spaceType(String)
let extensionPLMType(String)
let listOfPLMSpaceOccurrences(List)
let result(Boolean)
 
let i(Integer)
let occurrenceSpaceQueryResult(PLMOccurrenceQueryResult)
let attrValue(String)
 
minX = -500
minY = 500
minZ = 200
maxX = 500
maxY = 1500
maxZ = 700
filterVolumeMode = 3
spaceType="SSM_DesignSpaceRef"
 
i = 1
 
result = QuerySpaces(minX,minY,minZ,maxX,maxY,maxZ,spaceConceptRoot,filterVolumeMode,spaceType,extensionPLMType,listOfPLMSpaceOccurrences) 
 
if (result)
{
for i while i <= listOfPLMSpaceOccurrences.Size()   
{        
occurrenceSpaceQueryResult = listOfPLMSpaceOccurrences.GetItem(i)       
if(occurrenceSpaceQueryResult <> NULL)       
{                      
attrValue = occurrenceSpaceQueryResult.GetAttributeString("V_Name")
Message(attrValue)                      
}                                           
}
}
else
Message("Failed.")

QueryObjects

You can use this function to query the products in a given space.

Signature

ProductOccurrence -> QueryObjects(RootReference: PhysicalProduct,
                        FilterVolumeMode: Integer,
                        Clearance: Length,
                        ObjectPLMType: String,
                        ListOfObjects: out List): Boolean

Arguments

Name Input / Output Required? Type Comment
ThisSpaceOccurrence In Yes ProductOccurrence The occurrences of the space which is being intersected by some products.
RootRef In Yes PhysicalProduct It specifies the reference of the root product under which the intersecting product is retrieved with the query.
filterVolumeMode In Yes Integer Mode of query:
  • 1 (Fully IN)
  • 2 (Fully OUT)
  • 3 (Partly IN)
  • 4 (Partly OUT).
clearance In Yes Length It specifies the clearance distance around the input object.
productType In Yes String Name of the product type to filter.
listOfPrdOccurences Out Yes List Output list of the product occurrences in the given space based on the mode of query.

ReturnType

Boolean

TRUE if the query is successful, FALSE if not.

Example

let filterVolumeMode (Integer) 
let clearance(LENGTH) 
let productType(String)
let listOfPrdOccurences(List)
let prdOccurrence(ProductOccurrence) 
let objQueryResult(PLMOccurrenceQueryResult)
let i(Integer)
let QueryResult(Boolean)
let attrValue(String)

filterVolumeMode = 3
clearance=0m
i=1 

QueryResult =ThisSpaceOccurrence.QueryObjects(RootRef,
       filterVolumeMode,
       clearance,productType, 
       listOfPrdOccurences)
  
if(QueryResult)
{    
	for i while i <= listOfPrdOccurences.Size()    
	{        
		objQueryResult = listOfPrdOccurences.GetItem(i)       
		 if(objQueryResult <> NULL)        
		{            
			attrValue= objQueryResult.GetAttributeString("PLM_ExternalID")     
			Message(attrValue) 
		}     
	}
}

PLMCoreReference.CreateDeclaredSpaceAssignment()

You can use this function to create an assignment between a space reference and a logical reference.

Signature

PLMCoreReference.CreateDeclaredSpaceAssignment(SpaceReference : SPP_SpaceRef) : Boolean

Arguments

Name Input / Output Required? Type Comment
SpaceReference In Yes SPP_SpaceRef Space reference which is to be assigned to the PLMCoreReference.

ReturnType

Boolean

TRUE if the assignment is successful, FALSE if not.

Example

if ThisObjReference <> NULL
{
	ThisObjReference.CreateDeclaredSpaceAssignment(SpaceRef) 
}

PLMCoreInstance.CreateDeclaredSpaceAssignment()

You can use this function to create an assignment between a space reference and a logical instance.

Signature

PLMCoreInstance.CreateDeclaredSpaceAssignment(SpaceReference : SPP_SpaceRef) : Boolean

Arguments

Name Input / Output Required? Type Comment
SpaceReference In Yes SPP_SpaceRef Space reference which is to be assigned to the PLMCoreInstance.

ReturnType

Boolean

TRUE if the assignment is successful, FALSE if not.

Example

if ThisObjInstance <> NULL
{
	ThisObjInstance.CreateDeclaredSpaceAssignment(SpaceRef) 
}

PLMCoreReference.RemoveDeclaredSpaceAssignment()

You can use this function to remove assignment between a space reference and a logical reference.

Signature

PLMCoreReference.RemoveDeclaredSpaceAssignment(SpaceReference : SPP_SpaceRef) : Boolean

Arguments

Name Input / Output Required? Type Comment
SpaceReference In Yes SPP_SpaceRef Space reference whose assignment needs to be removed.

ReturnType

Boolean

TRUE if the removal of assignment is successful, FALSE if not.

Example

if ThisObjReference <> NULL
{
	ThisObjReference.RemoveDeclaredSpaceAssignment(SpaceRef) 
}

PLMCoreInstance.RemoveDeclaredSpaceAssignment()

You can use this function to remove assignment between a space reference and a logical instance.

Signature

PLMCoreInstance.RemoveDeclaredSpaceAssignment(SpaceReference : SPP_SpaceRef) : Boolean

Arguments

Name Input / Output Required? Type Comment
SpaceReference In Yes SPP_SpaceRef Space reference whose assignment needs to be removed.

ReturnType

Boolean

TRUE if the removal of assignment is successful, FALSE if not.

Example

if ThisObjInstance <> NULL
{
	ThisObjInstance.RemoveDeclaredSpaceAssignment(SpaceRef) 
}

SPP_SpaceRef.GetAssignedObjects()

You can use this function to retrieve the logical components assigning the input space reference.

Signature

SPP_SpaceRef.GetAssignedObjects(ObjectType : String, ListOfAssignedObjects : List) : Boolean

Arguments

Name Input / Output Required? Type Comment
ObjectType In Yes String Name of the PLM type of the reference or instance.
ListOfAssignedObjects Out Yes List List of PLMOccurrenceQueryResult of the assigned references or instances.

ReturnType

Boolean

TRUE if the objects are retrieved successfully, FALSE if not.

Example

let listAssignedObjects(List)

let ObjType(String)

let assignedObjQueryRes(PLMOccurrenceQueryResult)
let attrValue(String)

let i(Integer)

let result(Boolean)

ObjType="DatabaseObjectType"
i=1

result  = ThisSpaceRef.GetAssignedObjects(ObjType,listAssignedObjects) 

if listAssignedObjects.Size() > 0
{
	for i while  i <= listAssignedObjects.Size()
	{
		assignedObjQueryRes = listAssignedObjects.GetItem(i)
		if(assignedObjQueryRes <> NULL)
		{
			set attrValue = assignedObjQueryRes.GetAttributeString("V_Name")
			Message(attrValue)
		}
		
	}
}

PLMCoreReference.GetAssigningSpaces()

You can use this function to retrieve space references assigned to a logical reference.

Signature

PLMCoreReference.GetAssigningSpaces(SpacePLMType : String, ExtensionPLMType : String, AssigningSpaceRefs : List, FilterOnlyUnderSpaceFolder : Boolean) : Boolean

Arguments

Name Input / Output Required? Type Comment
SpacePLMType In Yes String Name of space type to filter. For example, SSM_DesignSpaceRef or SSM_ManufacturingSpaceRef
ExtensionPLMType In Yes String Name of extension type to filter.
AssigningSpaceRefs Out Yes List List of PLMOccurrenceQueryResult of the assigning space references.
FilterOnlyUnderSpaceFolder In No Boolean States if the result must contain only space references instantiated under the space folder set in the PRM table.

ReturnType

Boolean

TRUE if the spaces are retrieved successfully, FALSE if not.

Example

let AssigningSpaces(List)
let spaceType(String)
let objReference(PLMCoreReference)
 
let extnType(String)
let spaceRef(SPP_SpaceRef)
 
let spaceRefQueryRes(PLMOccurrenceQueryResult)
let assigningSpace(DatabaseObjectType)
let i(Integer)
let result(Boolean)
let nbSpaces(Integer)
let attrValue(String)
i=1
 
set objReference=objOcc.Reference
spaceType="SSM_DesignSpaceRef"
 
Message("Name: ", objReference.Name)
result = objReference.GetAssigningSpaces(spaceType,extnType,AssigningSpaces)
/* OR result = objReference.GetAssigningSpaces(spaceType,extnType,AssigningSpaces,TRUE) */
 
if AssigningSpaces.Size() > 0
{
  nbSpaces = AssigningSpaces.Size()
  Message("Nb Spaces: ", nbSpaces)
  for i while i <= AssigningSpaces.Size()
  {
    set spaceRefQueryRes = AssigningSpaces.GetItem(i)
    if(spaceRefQueryRes <> NULL)
    {
      attrValue=spaceRefQueryRes.GetAttributeString("V_Name")
      Message(attrValue)
      set assigningSpace = spaceRefQueryRes.LoadResult(FALSE)
    }
  }
}

PLMCoreInstance.GetAssigningSpaces()

You can use this function to retrieve space references assigned to a logical instance.

Signature

PLMCoreInstance.GetAssigningSpaces(SpacePLMType : String, ExtensionPLMType : String, AssigningSpaceRefs : List, FilterOnlyUnderSpaceFolder : Boolean) : Boolean

Arguments

Name Input / Output Required? Type Comment
SpacePLMType In Yes String Name of space type to filter. For example, SSM_DesignSpaceRef or SSM_ManufacturingSpaceRef
ExtensionPLMType In Yes String Name of extension type to filter.
AssigningSpaceRefs Out Yes List List of PLMOccurrenceQueryResult of the assigning space references.
FilterOnlyUnderSpaceFolder In No Boolean States if the result should contain only space references instantiated under the space folder set in the PRM table.

ReturnType

Boolean

TRUE if the spaces are retrieved successfully, FALSE if not.

Example

let AssigningSpaces(List)
let spaceType(String)
let objInst(PLMCoreInstance)
   
let extnType(String)
let spaceRef (SPP_SpaceRef)

let spaceRefQueryRes(PLMOccurrenceQueryResult)
let assigningSpace(DatabaseObjectType)
let i(Integer)
let result(Boolean)
let nbSpaces(Integer)
let attrValue(String)
i=1

set objInst=objOcc.Instance
spaceType="SSM_DesignSpaceRef"

Message("Name: ", objInst.Name)
result = objInst.GetAssigningSpaces(spaceType,extnType,AssigningSpaces)
/* OR result = objInst.GetAssigningSpaces(spaceType,extnType,AssigningSpaces,TRUE) */

if AssigningSpaces.Size() > 0
{
        nbSpaces = AssigningSpaces.Size()
        Message("Nb Spaces: ", nbSpaces)
        for i while i <= AssigningSpaces.Size()
        {
               set spaceRefQueryRes = AssigningSpaces.GetItem(i)
               if(spaceRefQueryRes <> NULL)
               {
                       attrValue=spaceRefQueryRes.GetAttributeString("V_Name")
                       Message(attrValue)
                       set assigningSpace= spaceRefQueryRes.LoadResult(FALSE)
               }
        }
}

IsContaining

You can use this function to check whether a given product or feature or coordinate intersects a given space reference or not.

Signature

ProductOccurrence -> IsContaining(TargetObject: Feature, Status: String, InclusionRatio:Real):Boolean

Arguments

Name Input / Output Required? Type Comment
InputProduct In Yes ProductOccurrence It specifies the occurrences of a space reference.
TargetObject In Yes Feature It specifies the feature whose intersection with space reference is to be checked.
Status Out Yes String It checks whether the geometry intersects a space reference fully or partially, or does not intersect the space reference.

FullyIN : TargetObject is fully intersected.

FullyOUT : TargetObject is not intersected.

PartiallyIN : TargetObject is partially intersected.

InvalidInput : TargetObject is invalid to compute, for instance it is non-watertight or zero-volume.
InclusionRatio Out No Real It computes the inclusion ratio (intersected volume / target volume).

The given ProductOccurrence must be an occurrence of a SpaceReference(SPP_SpaceRef). This is checked before computing the intersection status.

ReturnType

Boolean

TRUE if the API is successfully completed, FALSE if the API is not successfully completed.

Example

/*
Input Argument:
InputProduct(ProductOccurrence)
TargetObject(Feature)
*/

let res(Boolean)

let intersectionStatus(String)
let intersectionRatio(Real)

res = InputProduct.IsContaining(TargetObject, intersectionStatus, intersectionRatio)
if(res)
{
	Message("Intersection status : #, Intersection ratio : ", intersectionStatus, intersectionRatio)
}

FindContainingSpaces

It retrieves space references containing the plane based defined using a point and direction.

Signature

InputProduct -> FindContainingSpaces(iPoint : Point, iVector : Vector, oLeafSpaces : List, oUpperSpaces : List) : Boolean

Arguments

Name Input / Output Required? Type Comment
InputProduct In Yes Product occurrence Occurrence of space concept root or space reference which contains the space references to be retrieved.
iPoint In Yes Point

These arguments retrieve space references containing iPoint.

iPoint: Point used to retrieve containing spaces.

iVector: Indicates searching direction from the iPoint.
iVector In Yes Vector
oLeafSpaces Out Yes List Spaces which contain the iPoint. They are leaf nodes in the space hierarchy. If the retrieved space is not created from space system (if it is created manually), it is included in this list.
oUpperSpaces Out Yes List Spaces containing the iPoint that are upper nodes in the space hierarchy.

Return Type

Boolean

TRUE: if containing spaces are retrieved successfully. FALSE: if there are no spaces containing iPoint

Example

/*
Input Argument:
InputProduct(ProductOccurrence)
iPoint(Point)
*/

let result(Boolean)
let iVector(Vector)
let oLeafSpaces(List)
let oUpperSpaces(List)

set iVector = [0, 0, 1]

set result = InputProduct.FindContainingSpaces(iPoint, iVector, oLeafSpaces, oUpperSpaces)
if(TRUE ==  result)
{
  let i(Integer)
  For i = 1 while i <= oLeafSpaces.Size()
  {
    Message("oLeafSpaces: ", oLeafSpaces [i])
}
  For i = 1 while i <= oUpperSpaces.Size()
  {
    Message("oUpperSpaces: ", oUpperSpaces [i])
}
}