coin3d的坐标系

Chinese forum
Post Reply
johnwang
Posts: 445
Joined: Sun Jan 27, 2019 12:41 am

coin3d的坐标系

Post by johnwang » Tue Jun 02, 2020 1:48 pm

用如下的宏画了一个六面体。宽10,高20,深50。可以看出coin3d用的是屏幕坐标系。屏幕是x-y平面。从屏幕出来是z的正方向。相当于freeCad的top view.

Code: Select all

from pivy import coin

sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()
cub = coin.SoCube()
cub.width=10
cub.height=20
cub.depth=50
myCustomNode = coin.SoSeparator()
myCustomNode.addChild(cub)
sg.addChild(myCustomNode)
coin3dcube.jpg
coin3dcube.jpg (3.59 KiB) Viewed 815 times
Last edited by johnwang on Wed Jun 03, 2020 5:58 am, edited 1 time in total.

paullee
Posts: 2661
Joined: Wed May 04, 2016 3:58 pm

Re: coin3d的坐标系

Post by paullee » Tue Jun 02, 2020 4:48 pm

一直不懂 Scenegraph / Coin, 歡迎多點教材 :)

johnwang
Posts: 445
Joined: Sun Jan 27, 2019 12:41 am

Re: coin3d的坐标系

Post by johnwang » Tue Jun 02, 2020 11:00 pm

paullee wrote:
Tue Jun 02, 2020 4:48 pm
一直不懂 Scenegraph / Coin, 歡迎多點教材 :)
Scenegraph就是个绘图空间。你造好一个六面体,贴好标签(SoSeparator),扔到里面就可以了。

标签上写着各种如何摆放的指示。比如刷什么颜色,平移到哪里,转个角度什么的。当然,这些辅助的东西,必须在做标签之前就有了。比如对应颜色,必须先准备好油漆。

Code: Select all

from pivy import coin

#找到绘图空间
sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()

#做六面体
cub = coin.SoCube()
cub.width=10
cub.height=20
cub.depth=50

#做标签
myCustomNode = coin.SoSeparator()

#把标签挂到六面体上
myCustomNode.addChild(cub)

#扔到绘图空间里
sg.addChild(myCustomNode)

paullee
Posts: 2661
Joined: Wed May 04, 2016 3:58 pm

Re: coin3d的坐标系

Post by paullee » Wed Jun 03, 2020 12:37 pm

johnwang wrote:
Tue Jun 02, 2020 11:00 pm

Code: Select all

from pivy import coin

#找到绘图空间
sg = FreeCADGui.ActiveDocument.ActiveView.getSceneGraph()

#做六面体
cub = coin.SoCube()
cub.width=10
cub.height=20
cub.depth=50

#做标签
myCustomNode = coin.SoSeparator()

#把标签挂到六面体上
myCustomNode.addChild(cub)

#扔到绘图空间里
sg.addChild(myCustomNode)
感謝 ! 希望 有更多人 可學習 及應用 :D

Post Reply