"Failed to get owner occurrence transform" - Rectangular Pattern of Occurrences
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am running into an error using the API while trying to perform a Rectangular Pattern on an occurrence of a component.
In general, I am trying to create a new "Parent" component / occurrence in a design that will hold "Child" hardware component occurrences. The script successfully creates the "Parent" component / occurrence activates the new occurrence creates the "Child" hardware occurrences and pattens them. However, when I review the Timeline the Rectangular Pattern features show "yellow / sick" and have the following error:
Double clicking / opening the sick pattern feature and closing resolves the "sick / yellow" warning and the pattern seems to be stable.
Below is the "Generalized" section of code used to perform this operation:
import adsk.core, adsk.fusion, adsk.cam, traceback
app: adsk.core.Application = adsk.core.Application.get()
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
ui = app.userInterface
root = design.rootComponent
vector = adsk.core.Vector3D.create(0.0, 0.0, 0.0)
transform = adsk.core.Matrix3D.create()
transform.translation = vector
parent_part_occ = root.occurrences.addNewComponent(transform)
parent_part_occ.component.name = "Parent Part"
parent_part_occ.component.description = "Parent Part"
#create parts list to add occurrances
child_parts_add_list = ['123', '456', '789']
child_parts_add_qty = ['16', '2', '1']
child_parts_add_desc = ["Name 1", "Name 2", "Name 3"]
parent_part_occ.activate = True
for part, qty, desc in zip(child_parts_add_list, child_parts_add_qty, child_parts_add_desc):
new_occ = parent_part_occ.component.occurrences.addNewComponent(transform)
new_occ.component.name = desc
new_occ.component.description = desc
new_occ.component.partNumber = part
if int(qty) > 1:
# Create input entities for rectangular pattern
inputEntites = adsk.core.ObjectCollection.create()
inputEntites.add(new_occ)
# Get x and y axes for rectangular pattern
xAxis = root.xConstructionAxis
yAxis = root.yConstructionAxis
# Quantity and distance
quantityOne = adsk.core.ValueInput.createByString(qty)
distanceOne = adsk.core.ValueInput.createByString('1 in')
quantityTwo = adsk.core.ValueInput.createByString('1')
distanceTwo = adsk.core.ValueInput.createByString('0 in')
# Create the input for rectangular pattern
rectangularPatterns = parent_part_occ.component.features.rectangularPatternFeatures
rectangularPatternInput = rectangularPatterns.createInput(inputEntites, xAxis, quantityOne, distanceOne, adsk.fusion.PatternDistanceType.SpacingPatternDistanceType)
# Set the data for second direction
rectangularPatternInput.setDirectionTwo(yAxis, quantityTwo, distanceTwo)
# Create the rectangular pattern
rectangularFeature = rectangularPatterns.add(rectangularPatternInput)
rectangularFeature.name = "Pattern " + desc
inputEntites.clear
parent_part_occ.activate = False
I am wondering what this error means and how to avoid the code from causing the Rectangular Pattern to be created with this warning. It seems suspect that a open / close of the feature resolves the issue.
Thank you,