鱼C论坛

 找回密码
 立即注册
查看: 4054|回复: 0

[技术交流] 关于PyhtonOCC的建模

[复制链接]
发表于 2021-2-18 12:09:03 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
由于occ更新过于快,之前的一些包总是没办法在现在使用了,我现在记录一下一些建模的的方法

参考了诸位大佬[1][2[1]],[2]我写点笔记

1.生成直线:
这段代码是生成xyz上面的三个直线

  1. from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
  2. from OCC.gp import gp_Pnt
  3. from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeEdge, BRepBuilderAPI_MakeWire
  4. from OCC.GC import GC_MakeSegment
  5. from OCC.Display.SimpleGui import init_display



  6. aSegment12 = GC_MakeSegment(gp_Pnt(0, 0, 0), gp_Pnt(100, 0, 0))
  7. aEdge_x = BRepBuilderAPI_MakeEdge(aSegment12.Value()).Edge()

  8. aSegment12 = GC_MakeSegment(gp_Pnt(0, 0, 0), gp_Pnt(0, 100, 0))
  9. aEdge_y = BRepBuilderAPI_MakeEdge(aSegment12.Value()).Edge()

  10. aSegment12 = GC_MakeSegment(gp_Pnt(0, 0, 0), gp_Pnt(0, 0, 100))
  11. aEdge_z = BRepBuilderAPI_MakeEdge(aSegment12.Value()).Edge()

  12. if __name__ == "__main__":
  13.     from OCC.Display.SimpleGui import init_display

  14.     display, start_display, add_menu, add_function_to_menu = init_display()
  15.     for i in range(len(Ox)):
  16.         display.DisplayShape(v[i], update=True, color=rgb_color(0, 1, 0))
  17.     display.DisplayShape(aEdge_x, update=True, color="red")
  18.     display.DisplayShape(aEdge_y, update=True, color="green")
  19.     display.DisplayShape(aEdge_z, update=True, color="blue")
  20.     display.DisplayShape(orgin, update=True, color="yellow")

  21.     start_display()
复制代码



小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-15 09:44

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表