• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            eryar

            PipeCAD - Plant Piping Design Software.
            RvmTranslator - Translate AVEVA RVM to OBJ, glTF, etc.
            posts - 603, comments - 590, trackbacks - 0, articles - 0

            OpenCASCADE Ring Type Spring Modeling

            Posted on 2016-03-05 00:51 eryar 閱讀(2266) 評論(0)  編輯 收藏 引用 所屬分類: 2.OpenCASCADE

            OpenCASCADE Ring Type Spring Modeling

            eryar@163.com

            Abstract. The general method to directly create an edge is to give a 3D curve as the support(geometric domain) of the edge. The curve maybe defined as a 2D curve in the parametric space of a surface: PCurve. When you understand the pcurve, you can modeling some interesting shapes, such as bottle neck thread, helix spring, ring type spring. Etc. The paper is focus on the Ring Type Spring Modeling in OpenCASCADE Draw Test Harness by Tcl script.

            Key Words. Spring, Helix, Tcl/Tk, 環形彈簧

            1. Introduction

            在上網的時候不經意看到了ZWCAD論壇上的這么一個帖子:環形彈簧三維建模練習:http://www.zwcad.com/community/forum.php?mod=viewthread&tid=2302

            wps_clip_image-2001

            Figure 1.1 Ring Type Spring

            從上圖可見,這個圖形還是很有趣的,論壇中給出了在ZW中造型的一種方法,即先創建一個螺旋圓環,再用圓形陳列來得到這個環形彈簧。

            如何在OpenCASCADE中來造型呢?我想的方法是利用掃掠,關鍵就是掃掠的路徑環形螺放線的構造出來。因為原來使用過pcurve來生成過一個普通的彈簧,所以在想能不能在這個基礎上進行擴展,來對這種環形彈簧來造型。

            2.PCurve 

            根據pcurve的定義:The curve may be defined as a 2d curve in the parametric space of a surface. 可以看出pcurve的兩個特點:

            v pcurve是一條二維曲線;

            v 與曲面相關;

            即pcurve就是曲面參數空間中一條二維曲線,pcurve上的點就是曲面參數空間中的點,其映射過程為:pcurve根據一個參數x計算得到一個二維點(u,v),將這個二維點(u,v)作為曲面的參數計算出曲面上的點S(u,v),即為pcurve對應到曲面上的曲線。因為是環形的,所以我聯想到了Torus曲面,如下圖所示:

            wps_clip_image-2987

            Figure 2.1 Torus in OpenCASCADE Draw Test Harness

            在Draw Test Harness中生成一個圓環面還是很簡單的,只需要以下幾條命令:

            pload ALL 

            torus t 
            1 0.3 

            mkface f t 

            vdisplay f 

            根據利用圓柱面來對普通彈簧造型的方法“Make Helix Curve in OpenCASCADE”

            http://m.shnenglu.com/eryar/archive/2015/07/09/211212.html ,是否可以利用圓環面來生成圓環彈簧呢?實踐是檢驗真理的唯一標準,隨便嘗試,反正失敗了也沒有什么損失。要利用pcurve就要找出曲面及其參數空間的一條二維曲線,現在初步確定了曲面為torus面,下面再來尋找pcurve。根據《OpenCASCADE BRep Format》中對于Torus的參數表示方程為:

            wps_clip_image-16710

            wps_clip_image-3246

            由參數方程可知,torus面的參數空間為0到2PI的一個正方形區域,如下圖所示:

            wps_clip_image-5822

            Figure 2.2 PCurve of Torus Face

            當u=0或v=0時,曲面的參數方程為:

            wps_clip_image-24802

            wps_clip_image-493wps_clip_image-14106

            Figure 2.3 Torus curves when u=0 and v=0

            對應到參數空間分別為u軸上的直線和v軸上的直線。當u取幾個固定值,v在參數空間任意變化時,即可以得到圓環面上幾個圓形曲線。當u,v參數連續變化時,先用最簡單的一次曲線直線來嘗試下,Tcl腳本如下所示:

             

            # 
            # make helix torus in OpenCASCADE. 
            # Shing Liu(eryar@163.com) 
            # 2016-02-20 21:00 


            pload MODELING VISUALIZATION 

            # use torus surface. 
            torus aTorus 10 2 

            set aSlope 
            0.05 
            line aLine2d 
            0 0 $aSlope 1 
            trim aSegment aLine2d 
            0 2*pi 

            # make edge by the pcurve. 
            mkedge aHelixEdge aSegment aTorus 0 2*pi/$aSlope 

            # there is no curve 3d in the pcurve edge. 
            # so need this to approximate one. 

            mkedgecurve aHelixEdge 0.01 

            # display the edge. 
            vdisplay  aHelixEdge 

            生成結果如下圖所示:

            wps_clip_image-19095

            Figure 2.4 Torus Curve made by pcurve

            其中螺距的調整可以通過調整pcurve的斜率來實現。

            wps_clip_image-17217

            Figure 2.5 Torus Spring

            由圖可見,pcurve使用直線效果比較理想。曲線生成之后,只需要將一個輪廓沿著曲線掃掠即可。

            3.Modeling in Draw Test Harness

            將上述放在一起來實現一個環形彈簧的造型,為了便于測試,主要是在Draw Test Harness中使用Tcl腳本來測試效果。使用Tcl腳本來測試效果有很多好處,主要就是不需要編寫C++代碼,也不用編譯,可以實時檢驗結果。而且OpenCASCADE的Tcl腳本也可以很方便地翻譯成C++代碼。所以學習一下Tcl腳本還是有很多好處的,如Tcl具有跨平臺的特性,通過使用腳本,可以對參數化有更進一步的理解等。言歸正傳,下面給出環形彈簧造型的Tcl腳本:

             

            #
            # make helix torus(Ring Type Spring) in OpenCASCADE.
            # Shing Liu(eryar@163.com)
            # 2016-02-20 21:00
            #


            pload MODELING VISUALIZATION

            # use torus surface.
            torus aTorus 10 2

            set aSlope 
            0.05
            line aLine2d 
            0 0 $aSlope 1
            trim aSegment aLine2d 
            0 2*pi

            # make edge by the pcurve.
            mkedge aHelixEdge aSegment aTorus 0 2*pi/$aSlope

            # there is no curve 3d in the pcurve edge.
            # so need this to approximate one.

            mkedgecurve aHelixEdge 0.01

            wire aHelixWire aHelixEdge

            # make the profile.
            circle aProfile 12 0 0 1 1 1 0.3
            mkedge aProfile aProfile
            wire aProfile aProfile
            mkplane aProfile aProfile

            # display the profile.
            vdisplay aProfile aHelixEdge

            # loft the circle along the helix curve.
            pipe aSpring aHelixWire aProfile

            # display the result.
            vdisplay aSpring
            #vsetmaterial aSpring steel
            vsetgradientbg 180 200 255 180 180 180 2
            vsetdispmode 
            1
            vzbufftrihedron

            set ray tracing
            if { ! [catch {vrenderparams -raytrace -shadows -reflections -fsaa -rayDepth 5}] } {
              vtextureenv on 
            1
            }

            生成結果如下圖所示:

            wps_clip_image-6995

            下圖是使用Ray Tracing后顯示的效果,感覺不錯:

            wps_clip_image-31391

            wps_clip_image-23847

            4. Conclusion

            綜上所述,理解了pcurve后可以對一些規則的有趣的曲線進行造型。另外學會在Draw Test Harness中使用Tcl腳本來嘗試自己的想法,將會感覺到腳本的便利性。其實在OpenCASCADE的官網上也是提倡使用Tcl腳本來報告bug。

            5. References

            1. OpenCASCADE BRep Format

            2. Shing Liu. Make Helix Curve in OpenCASCADE. 

            http://m.shnenglu.com/eryar/archive/2015/07/09/211212.html

            3. ZW3D community topic:

            http://www.zwcad.com/community/forum.php?mod=viewthread&tid=2302

             

            99热都是精品久久久久久| 久久99精品九九九久久婷婷| 69SEX久久精品国产麻豆| 久久国产精品99久久久久久老狼| 国产精品伦理久久久久久| 伊人久久国产免费观看视频| 久久久久人妻精品一区| 久久综合久久伊人| 久久国产免费观看精品| 亚洲精品综合久久| 99久久久久| 国内精品久久久久久久97牛牛| 欧美激情精品久久久久久| 久久久青草青青亚洲国产免观| 久久久久亚洲精品日久生情| 国内精品久久久久国产盗摄| aaa级精品久久久国产片| 久久久午夜精品| 久久国产一片免费观看| 久久免费精品视频| 久久棈精品久久久久久噜噜| 久久婷婷午色综合夜啪| 久久精品国产99久久丝袜| 国产午夜精品久久久久九九电影 | 国产午夜精品久久久久九九| 久久亚洲AV成人无码电影| 国产aⅴ激情无码久久| 综合久久精品色| 香蕉久久久久久狠狠色| 精品国产日韩久久亚洲| 三级三级久久三级久久| 久久精品国产亚洲AV蜜臀色欲 | 久久久久这里只有精品| 久久国产福利免费| 久久久久国产一区二区三区| 久久久久亚洲AV无码专区网站| 一本大道久久a久久精品综合| 91久久香蕉国产熟女线看| 精品久久人人爽天天玩人人妻| 久久久99精品成人片中文字幕| 久久久久国产精品麻豆AR影院 |