Occurrences Object
Derived from:
Base Object
Defined in namespace "adsk::fusion" and the header file is <Fusion/Components/Occurrences.h>
Description
Provides access to occurrences within a component and provides methods to create new occurrences.
Methods
addByInsert |
Method that inserts an existing file. |
addExistingComponent |
Method that creates a new occurrence using an existing component. This is the equivalent of copying and pasting an occurrence in the user interface. |
addFromConfiguration |
Method that inserts a configuration from a configured design. The insert will fail if the configured design being used is not from the same project as the file it is being inserted into. |
addNewComponent |
Method that creates a new component and an occurrence that references it. |
addNewComponentCopy |
Method that creates a new occurrence by creating a new component that is a copy of an existing component. This is the equivalent of copying and using the "Paste New" command in the user interface. This is different from the addExistingComponent in that it's not a new instance to the existing component but a new component is created that has it's own definition (sketches, features, etc.) and a new occurrence instance is created to reference this new component. |
asArray |
Get the current list of all occurrences. The occurrences are returned in the same order as they appear in the browser. |
classType |
Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType(). |
item |
Function that returns the specified occurrence using an index into the collection. |
itemByName |
Returns the specified occurrence using the name of the occurrence. |
Properties
asList |
Returns the contents of this collection as an OccurrencesList object. This is useful when writing a function that traverses an assembly. |
count |
Returns the number of occurrences in the collection. |
isValid |
Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference. |
objectType |
This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.
It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType(): |
Accessed From
BaseComponent.occurrences,
Component.occurrences,
FlatPatternComponent.occurrences
Samples
Assembly traversal using recursion API Sample |
Traverses the entire structure of the currently open assemlby using a recursive function and displays the result in a message box. This will match the occurrence structure seen in the browser. |
Version
Introduced in version August 2014