-
大小: 506KB文件類型: .rar金幣: 2下載: 1 次發(fā)布日期: 2021-06-11
- 語言: Python
- 標(biāo)簽: PythonOCC??應(yīng)用實(shí)例??sample??
資源簡介
使用用于Python的Open cascade庫PythonOCC,可以快速實(shí)現(xiàn)關(guān)于OCC的開發(fā)。

代碼片段和文件信息
#!/usr/bin/env?python
##Copyright?2009?Thomas?Paviot?(tpaviot@gmail.com)
##
##This?file?is?part?of?pythonOCC.
##
##pythonOCC?is?free?software:?you?can?redistribute?it?and/or?modify
##it?under?the?terms?of?the?GNU?General?Public?License?as?published?by
##the?Free?Software?Foundation?either?version?3?of?the?License?or
##(at?your?option)?any?later?version.
##
##pythonOCC?is?distributed?in?the?hope?that?it?will?be?useful
##but?WITHOUT?ANY?WARRANTY;?without?even?the?implied?warranty?of
##MERCHANTABILITY?or?FITNESS?FOR?A?PARTICULAR?PURPOSE.??See?the
##GNU?General?Public?License?for?more?details.
##
##You?should?have?received?a?copy?of?the?GNU?General?Public?License
##along?with?pythonOCC.??If?not?see? .
from?OCC.BRepPrimAPI?import?*
from?OCC.gp?import?*
from?OCC.TopLoc?import?*
from?OCC.AIS?import?*
from?OCC.Display.SimpleGui?import?*
display?start_display?add_menu?add_function_to_menu?=?init_display()
ais_boxshp=None
def?build_shape():
????global?ais_boxshp
????if?not?isinstance(ais_boxshpHandle_AIS_Shape):
????????boxshp?=?BRepPrimAPI_MakeBox(50.50.50.).Shape()
????????ais_boxshp?=?display.DisplayShape(boxshp)
????return?ais_boxshp
????????
def?rotating_cube_1_axis(event=None):
????build_shape()
????Ax1?=?gp_Ax1(gp_Pnt(000)gp_Dir(001))
????aCubeTrsf?=?gp_Trsf()
????angle?=?0.0
????for?i?in?range(2000):
????????aCubeTrsf.SetRotation(Ax1angle)
????????aCubeToploc?=?TopLoc_Location(aCubeTrsf)
????????display.Context.SetLocation(ais_boxshpaCubeToploc)
????????display.Context.UpdateCurrentViewer()
????????angle?+=?0.001
def?rotating_cube_2_axis(event=None):
????build_shape()
????Ax1?=?gp_Ax1(gp_Pnt(000)gp_Dir(001))
????Ax2?=?gp_Ax1(gp_Pnt(000)gp_Dir(010))
????aCubeTrsf?=?gp_Trsf()
????aCubeTrsf2?=?gp_Trsf()
????angle?=?0.0
????angle2?=?0.0
????for?i?in?range(2000):
????????aCubeTrsf.SetRotation(Ax1angle)
????????aCubeTrsf2.SetRotation(Ax2angle)
????????aCubeToploc?=?TopLoc_Location(aCubeTrsf*aCubeTrsf2)
????????display.Context.SetLocation(ais_boxshpaCubeToploc)
????????display.Context.UpdateCurrentViewer()
????????angle?+=?0.001
????
if?__name__?==?‘__main__‘:
????add_menu(‘a(chǎn)nimation‘)
????add_function_to_menu(‘a(chǎn)nimation‘?rotating_cube_1_axis)
????add_function_to_menu(‘a(chǎn)nimation‘?rotating_cube_2_axis)
????start_display()
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples
?????文件????????343??2010-01-05?22:35??pythonOCC-0.4-samples\AUTHORS
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\Animation
?????文件???????2320??2010-03-10?16:06??pythonOCC-0.4-samples\Level1\Animation\animation.py
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\Dimensions
?????文件????????625??2010-03-10?16:07??pythonOCC-0.4-samples\Level1\Dimensions\dimensions.py
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\FairCurve
?????文件???????1334??2009-12-17?17:06??pythonOCC-0.4-samples\Level1\FairCurve\faircurve.py
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\Geometry
?????文件??????42255??2009-12-03?13:05??pythonOCC-0.4-samples\Level1\Geometry\geometry_demos.py
?????文件???????7340??2009-12-04?15:54??pythonOCC-0.4-samples\Level1\Geometry\geomplate.py
?????文件???????3109??2009-12-04?15:54??pythonOCC-0.4-samples\Level1\Geometry\surfaces.py
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\Mesh
?????文件???????2737??2010-03-11?16:48??pythonOCC-0.4-samples\Level1\Mesh\simple_mesh.py
?????目錄??????????0??2010-03-10?15:15??pythonOCC-0.4-samples\Level1\OCAF
?????文件???????7909??2010-01-04?21:39??pythonOCC-0.4-samples\Level1\OCAF\dynamic_XCAF.py
?????文件???????3827??2009-12-17?17:06??pythonOCC-0.4-samples\Level1\OCAF\step_export.py
?????文件??????26336??2010-03-10?15:15??pythonOCC-0.4-samples\Level1\OCAF\step_la
?????文件???????5576??2009-12-17?17:06??pythonOCC-0.4-samples\Level1\OCAF\step_OCAF_import.py
?????文件?????413858??2009-04-07?04:35??pythonOCC-0.4-samples\Level1\OCAF\test.stp
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\OCAF\topological_naming
?????文件???????3080??2010-01-04?21:39??pythonOCC-0.4-samples\Level1\OCAF\topological_naming\named_shape_demo.py
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\Plot
?????文件???????4361??2009-08-10?19:43??pythonOCC-0.4-samples\Level1\Plot\plot.py
?????文件???????2712??2009-08-06?04:58??pythonOCC-0.4-samples\Level1\Plot\plot_view.py
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\Serialization
?????文件???????1263??2009-08-05?04:35??pythonOCC-0.4-samples\Level1\Serialization\TopoDS_Shape_pickling.py
?????目錄??????????0??2010-03-09?21:08??pythonOCC-0.4-samples\Level1\ShapeProperties
?????文件???????1668??2009-12-17?17:06??pythonOCC-0.4-samples\Level1\ShapeProperties\volume_properties.py
............此處省略142個(gè)文件信息
評(píng)論
共有 條評(píng)論