Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trouble ordering commands to make a object

0 REPLIES 0
Reply
Message 1 of 1
kostek.rodenburg
119 Views, 0 Replies

Trouble ordering commands to make a object

At the moment I have encountered a problem for a tool that is supposed to make a cage around an object, the point at which I got stuck is constructing the individual ribs. I use a for loop to copy and paste a rib, then move it around. The problem is that the original rib gets moved to the outmost point in the sketch and then the programme still sees that one as the original, so it continues in another dicection with that rib, which is not in the origin anymore.

 

        bodyX = extX.bodies.item(0)
        
        # Create a pattern on the X axis
        vectorOnXAxis = adsk.core.Vector3D.create(3.0, 0.0, 0.0)
        transformX = adsk.core.Matrix3D.create()
        transformX.translation = vectorOnXAxis
        
        # Create a move feature
        moveFeats = newComp.features.moveFeatures 
        newObjectsToCreate = adsk.core.ObjectCollection.create()
        moveFeatureInputX = moveFeats.createInput(newObjectsToCreate, transformX)

        for i in range(10):
            newObjectsToCreate.add(bodyZ)
            newComp.features.copyPasteBodies.add(bodyZ)
            moveFeats.add(moveFeatureInputX)
            
        for i in range(5):    
            newObjectsToCreate.add(bodyY)
            newComp.features.copyPasteBodies.add(bodyY)
            moveFeats.add(moveFeatureInputX)
        
        #Create pattern on the y axis
        vectorOnYAxis = adsk.core.Vector3D.create(0, 3.0, 0)
        transformY = adsk.core.Matrix3D.create()
        transformY.translation = vectorOnYAxis
        
        moveFeats = newComp.features.moveFeatures 
        newObjectsToCreate = adsk.core.ObjectCollection.create()
        moveFeatureInputY = moveFeats.createInput(newObjectsToCreate, transformY)
        
        for i in range(10):
            newObjectsToCreate.add(bodyZ)
            newComp.features.copyPasteBodies.add(bodyZ)
            moveFeats.add(moveFeatureInputY)
         
        for i in range(7): 
            newObjectsToCreate.add(bodyX)
            newComp.features.copyPasteBodies.add(bodyX)
            moveFeats.add(moveFeatureInputY)
Tags (2)
0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report