SDS2 Parametric API
 All Classes Namespaces Functions Variables Pages
Classes | Functions
Component Namespace Reference

Functions to add, read, edit, and delete components. More...

Classes

class  Component
 Components provide a way to extend the functionality of members using the Parametric API in a dynamic way that can't be recreated with a normal parametric. More...

Functions

def AddPairsOfComponentsToMember
def CopyPairsOfComponentsToMember
def Deselect
def Erase
def ExplodeComponent
def GetComponentsOnMember
def GetLiveComponentsOnMember
def GetLockedAndRefreshed
def GetRegisteredClasses
def GetSelectedComponents
def LocateMultiple
def LocateSingle
def LockModifies
def PrepareComponentForMember
def ReferencePointInGlobal
def RegisterComponentType
def RegisteredClassDescription
def ReplaceLiveComponentsWithCopy
def Select

Detailed Description

Functions to add, read, edit, and delete components.

Function Documentation

def Component.AddPairsOfComponentsToMember (   list_of_pairs_of_components_and_member_number)
Returns
Instance of type object
     Add components to multiple members in one transaction and return deep
     copies of the actual instances added to the members. The return
     value is useful if the calling code needs to know the uuid of the
     added component. If a particular component cannot be added to a
     specific member (see IsAllowedOnMember) None will be
     returned instead of a deep copy.
     Example: Add the selected components to member 1 and print uuids of the added components
     print [str(c.uuid) for c in AddPairsOfComponentsToMember([(GetSelectedComponents(), 1)])[0] if c is not None]
def Component.CopyPairsOfComponentsToMember (   list_of_pairs_of_components_and_member_number)
Returns
Instance of type object
     Copy components to multiple members in one transaction and return deep
     copies of the actual instances added to the members. The return
     value is useful if the calling code needs to know the uuid of the
     added component. If a particular component cannot be added to a
     specific member (see IsAllowedOnMember) None will be returned
     instead of a deep copy. Use this method instead of AddPairsOfComponentsToMember to ensure
     OnMemberCopy is called after the component is added to the member.
     Example: Copy the selected components to member 1 and print uuids of the added components
     print [str(c.uuid) for c in CopyPairsOfComponentsToMember([(GetSelectedComponents(), 1)])[0] if c is not None]
def Component.Deselect (   args)
Returns
Instance of type object
     Remove the component(s) from the current selection.
     Example: Deselect all the currently selected components
     Deselect(GetSelectedComponents())
def Component.Erase (   args)
Returns
Instance of type object
     Erase the component(s) from the job and return the actual instances
     of the erased component(s).  A component's member and Modifies
     list must be locked prior to erasing.
     Example: Erase the selected components
     Erase(LockModifies(GetSelectedComponents()))
def Component.ExplodeComponent (   component)
Returns
Instance of type object
     Convert all solids created by the component into user solids and
     remove the component from its host member
def Component.GetComponentsOnMember (   member_number)
Returns
Instance of type list
     Return deep copies of the components on the specified member.
def Component.GetLiveComponentsOnMember (   member_number)
Returns
Instance of type list
     Return the actual instances of the components on the specified member.
def Component.GetLockedAndRefreshed (   args)
Returns
Instance of type object
     Return locked and refreshed deep copies of the specified components.
     Example: Changing an existing component's state
     c = GetLockedAndRefreshed(GetSelectedComponents()[0])
     c.ref_point = Point3D.Point3D()
     ReplaceLiveComponentsWithCopy([c])
def Component.GetRegisteredClasses (   args)
Returns
Instance of type list
     Return the component classes registered with SDS2
     Example: map(RegisteredClassDescription, GetRegisteredClasses())
def Component.GetSelectedComponents (   args)
Returns
Instance of type list
     Return deep copies of the selected components.
def Component.LocateMultiple (   prompt,
  filter_function 
)
Returns
Instance of type bool
     Prompt the user to select multiple components satisfying the given
     condition and return True iff the user made a selection.
     Example: Prompt user to select any component
     LocateMultiple("prompt", lambda x: True)
def Component.LocateSingle (   prompt,
  filter_function 
)
Returns
Instance of type bool
     Prompt the user to select one component satisfying the given
     condition and return True iff the user made a selection.
     Example: Prompt user to select any component
     LocateSingle("prompt", lambda x: True)
def Component.LockModifies (   args)
Returns
Instance of type object
     Lock the modified members of the component(s) or throw an exception.
     Return the specified component(s).
def Component.PrepareComponentForMember (   component,
  member_number 
)
Returns
Instance of type object
     Set the component's member number and reset the uuid
def Component.ReferencePointInGlobal (   component)
Returns
Instance of type Point3D
     If the component is on a member return its ref_point in global coordinates.
     Example: Visualize the ref_point in global coordinates
     point.PointLocate(
         'ref_point is anchor'
         , point.Point(ReferencePointInGlobal(GetSelectedComponents()[0])))
def Component.RegisterComponentType (   component_subclass,
  description 
)
Returns
Instance of type str
     Make the specified component subclass available from the component
     add dialog with the preferred description and return the
     description that was actually registered. The preferred
     description will be the returned description unless a previously
     added component is already using the description.
     Example: Register a component and print the description SDS2 will display in the component add dialog
     print RegisterComponentType(SomeComponent, 'Some component')
def Component.RegisteredClassDescription (   class)
Returns
Instance of type str
     Return the registered description for the specified component class
     Example: map(lambda c: RegisteredClassDescription(c.__class__), GetSelectedComponents())
def Component.ReplaceLiveComponentsWithCopy (   args)
Returns
Instance of type object
     Update the live components associated with deep copies of the
     specified components. Return the replaced components.
     Example: Change an existing component's state
     c = GetLockedAndRefreshed(GetSelectedComponents()[0])
     c.ref_point = Point3D.Point3D()
     replaced = ReplaceLiveComponentsWithCopy([c])[0]
def Component.Select (   args)
Returns
Instance of type object
     Add the component(s) to the current selection.
     Example: Select all components on every member in the current view
     Select(sum([GetComponentsOnMember(m.number) for m in model.members(1)],[]))