문제

I'm trying to create a several cylinders with a loop, rotating each one slightly in 3 dimensions each time, a random amount.

Here's what I have so far:

until i == 200
        x += rand(10)
        y += rand(10)
        z += rand(10)
        xyz = rand(2)
        circle = entities.add_circle([x,y,z], axis[xyz], r, n)
        base = entities.add_face(circle)
        base.pushpull -h
        base.transform_entities(Geom::Transformation.rotation([0,0,0],[1,0,0],rand(360)),base)
        i += 1
        #sleep 0.2
    end

The transform_entities throws this error:

Error: #<NoMethodError: undefined method `transform_entities' for <Sketchup::Face:0x18836040>>

Any ideas how I can make this work? I've dug through the API docs but can't figure out a solution.

Thanks!

도움이 되었습니까?

해결책

I was incorrectly applying the transform to base rather than entities.

Should be:

entities.transform_entities(Geom::Transformation.rotation([0,0,0],[1,0,0],rand(360)),base)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top