• <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 閱讀(2238) 評(píng)論(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, 環(huán)形彈簧

            1. Introduction

            在上網(wǎng)的時(shí)候不經(jīng)意看到了ZWCAD論壇上的這么一個(gè)帖子:環(huán)形彈簧三維建模練習(xí):http://www.zwcad.com/community/forum.php?mod=viewthread&tid=2302

            wps_clip_image-2001

            Figure 1.1 Ring Type Spring

            從上圖可見(jiàn),這個(gè)圖形還是很有趣的,論壇中給出了在ZW中造型的一種方法,即先創(chuàng)建一個(gè)螺旋圓環(huán),再用圓形陳列來(lái)得到這個(gè)環(huán)形彈簧。

            如何在OpenCASCADE中來(lái)造型呢?我想的方法是利用掃掠,關(guān)鍵就是掃掠的路徑環(huán)形螺放線的構(gòu)造出來(lái)。因?yàn)樵瓉?lái)使用過(guò)pcurve來(lái)生成過(guò)一個(gè)普通的彈簧,所以在想能不能在這個(gè)基礎(chǔ)上進(jìn)行擴(kuò)展,來(lái)對(duì)這種環(huán)形彈簧來(lái)造型。

            2.PCurve 

            根據(jù)pcurve的定義:The curve may be defined as a 2d curve in the parametric space of a surface. 可以看出pcurve的兩個(gè)特點(diǎn):

            v pcurve是一條二維曲線;

            v 與曲面相關(guān);

            即pcurve就是曲面參數(shù)空間中一條二維曲線,pcurve上的點(diǎn)就是曲面參數(shù)空間中的點(diǎn),其映射過(guò)程為:pcurve根據(jù)一個(gè)參數(shù)x計(jì)算得到一個(gè)二維點(diǎn)(u,v),將這個(gè)二維點(diǎn)(u,v)作為曲面的參數(shù)計(jì)算出曲面上的點(diǎn)S(u,v),即為pcurve對(duì)應(yīng)到曲面上的曲線。因?yàn)槭黔h(huán)形的,所以我聯(lián)想到了Torus曲面,如下圖所示:

            wps_clip_image-2987

            Figure 2.1 Torus in OpenCASCADE Draw Test Harness

            在Draw Test Harness中生成一個(gè)圓環(huán)面還是很簡(jiǎn)單的,只需要以下幾條命令:

            pload ALL 

            torus t 
            1 0.3 

            mkface f t 

            vdisplay f 

            根據(jù)利用圓柱面來(lái)對(duì)普通彈簧造型的方法“Make Helix Curve in OpenCASCADE”

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

            wps_clip_image-16710

            wps_clip_image-3246

            由參數(shù)方程可知,torus面的參數(shù)空間為0到2PI的一個(gè)正方形區(qū)域,如下圖所示:

            wps_clip_image-5822

            Figure 2.2 PCurve of Torus Face

            當(dāng)u=0或v=0時(shí),曲面的參數(shù)方程為:

            wps_clip_image-24802

            wps_clip_image-493wps_clip_image-14106

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

            對(duì)應(yīng)到參數(shù)空間分別為u軸上的直線和v軸上的直線。當(dāng)u取幾個(gè)固定值,v在參數(shù)空間任意變化時(shí),即可以得到圓環(huán)面上幾個(gè)圓形曲線。當(dāng)u,v參數(shù)連續(xù)變化時(shí),先用最簡(jiǎn)單的一次曲線直線來(lái)嘗試下,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 

            生成結(jié)果如下圖所示:

            wps_clip_image-19095

            Figure 2.4 Torus Curve made by pcurve

            其中螺距的調(diào)整可以通過(guò)調(diào)整pcurve的斜率來(lái)實(shí)現(xiàn)。

            wps_clip_image-17217

            Figure 2.5 Torus Spring

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

            3.Modeling in Draw Test Harness

            將上述放在一起來(lái)實(shí)現(xiàn)一個(gè)環(huán)形彈簧的造型,為了便于測(cè)試,主要是在Draw Test Harness中使用Tcl腳本來(lái)測(cè)試效果。使用Tcl腳本來(lái)測(cè)試效果有很多好處,主要就是不需要編寫C++代碼,也不用編譯,可以實(shí)時(shí)檢驗(yàn)結(jié)果。而且OpenCASCADE的Tcl腳本也可以很方便地翻譯成C++代碼。所以學(xué)習(xí)一下Tcl腳本還是有很多好處的,如Tcl具有跨平臺(tái)的特性,通過(guò)使用腳本,可以對(duì)參數(shù)化有更進(jìn)一步的理解等。言歸正傳,下面給出環(huán)形彈簧造型的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
            }

            生成結(jié)果如下圖所示:

            wps_clip_image-6995

            下圖是使用Ray Tracing后顯示的效果,感覺(jué)不錯(cuò):

            wps_clip_image-31391

            wps_clip_image-23847

            4. Conclusion

            綜上所述,理解了pcurve后可以對(duì)一些規(guī)則的有趣的曲線進(jìn)行造型。另外學(xué)會(huì)在Draw Test Harness中使用Tcl腳本來(lái)嘗試自己的想法,將會(huì)感覺(jué)到腳本的便利性。其實(shí)在OpenCASCADE的官網(wǎng)上也是提倡使用Tcl腳本來(lái)報(bào)告bug。

            5. References

            1. OpenCASCADE BRep Format

            2. Shing Liu. Make Helix Curve in OpenCASCADE. 

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

            3. ZW3D community topic:

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

             

            国产精品久久久久天天影视| 国产成人久久精品区一区二区| 青青青青久久精品国产h| 久久久一本精品99久久精品66 | 色综合久久久久无码专区 | 久久久久亚洲av无码专区导航| 亚洲国产成人久久综合一区77| 国产精品伦理久久久久久| 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲高清不卡 国产成人精品久久亚洲 | 日韩精品久久久肉伦网站| 久久精品国产乱子伦| 久久精品人人做人人爽电影| 久久久一本精品99久久精品88| 精品久久人人爽天天玩人人妻| 久久这里都是精品| 久久精品中文无码资源站| 亚洲AV日韩精品久久久久| 久久久精品人妻一区二区三区四| 久久久久久午夜成人影院| 国产成人精品久久一区二区三区| 久久久精品午夜免费不卡| 国产精品免费久久久久电影网| 久久伊人亚洲AV无码网站| 国产69精品久久久久观看软件| 亚洲精品高清国产一线久久| 久久er99热精品一区二区| 亚洲狠狠综合久久| 色综合合久久天天给综看| 狠狠色丁香久久婷婷综合| 国产精品久久久久aaaa| 久久精品国产99国产精品| 7777精品伊人久久久大香线蕉| 亚洲精品无码久久久久| 99久久国产热无码精品免费久久久久| 久久精品成人免费观看97| 国产69精品久久久久9999APGF| 热99re久久国超精品首页| 欧美亚洲国产精品久久久久| 久久精品国产亚洲AV无码偷窥| 久久播电影网| 久久久久久久久无码精品亚洲日韩|