Trouble ordering commands to make a object

Trouble ordering commands to make a object

Anonymous
Not applicable
263 Views
0 Replies
Message 1 of 1

Trouble ordering commands to make a object

Anonymous
Not applicable

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)
0 Likes
264 Views
0 Replies
Replies (0)