Metasequoia BBS

| New message | Normal | Tree |
Status
Tag
Keyword
[9688] help rotate obj1 to 180 and move it down / no error in code.
Not necessary [Request,help! ] Response
import MQSystem

doc = MQSystem.getDocument()
objnum = doc.numObject

# Find the object to move
for oi in range(objnum):
    obj = doc.object[oi]
    if obj is not None and obj.name == "obj1":
        print("Found obj1")
        if hasattr(obj, "translation"):
            # Move the object down by 1 unit
            translation = obj.translation
            translation.y -= 1
            obj.translation = translation
            # Rotate the object 180 degrees
            rotation = MQSystem.newAngle(0, 180, 0)
            obj.rotation = rotation
        else:
            print("obj1 does not have a translation attribute")

Show more...
2023-02-15 15:40