對齊成功。

來源:互聯網
上載者:User

 
fn g_filter o = superclassof o == Geometryclass
fn find_intersection z_node node_to_z =
(
 --同樣的條件 數字及計算要比字串快 所以能用數字 不用字串。
 
oop=case of

  (

  (gt_yc_Ail.conunt_spn1.value ==1): [0,0,-1]

  (gt_yc_Ail.conunt_spn1.value ==2): [0,0,1]
   
  (gt_yc_Ail.conunt_spn1.value ==3):[-1,0,0]
   
  (gt_yc_Ail.conunt_spn1.value ==4):[1,0,0]
   
  (gt_yc_Ail.conunt_spn1.value ==5):[0,-1,0]
   
  (gt_yc_Ail.conunt_spn1.value ==6):[0,1,0]

  --default: reference $foo
  )

 local testRay = ray node_to_z.pos  oop
 local nodeMaxZ
  case oop  of
  (  ------Z 軸
   ([0,0,-1]) :(nodeMaxZ = z_node.max.z
    testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ
    
    )
   ([0,0,1]) :(nodeMaxZ = z_node.min.z
    testRay.pos.z = nodeMaxZ - 0.0001 * abs nodeMaxZ  
   )
   -------X軸 
   ([-1,0,0]) : (nodeMaxZ = z_node.max.x
    testRay.pos.x = nodeMaxZ + 0.0001 * abs nodeMaxZ   
   )
   ([1,0,0]) : (nodeMaxZ = z_node.min.x
   testRay.pos.x = nodeMaxZ - 0.0001 * abs nodeMaxZ   
   )
  ------- Y軸
         ([0,-1,0]) : (nodeMaxZ = z_node.max.y
   testRay.pos.y = nodeMaxZ + 0.0001 * abs nodeMaxZ   
   )
   ([0,1,0]) : (nodeMaxZ = z_node.min.y
   testRay.pos.y = nodeMaxZ - 0.0001 * abs nodeMaxZ   
   ) 
  )  
 
 --testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ
 intersectRay z_node testRay
)

 try(destroyDialog gt_yc_Ail)catch()
rollout gt_yc_Ail "yongchao-對齊" width:168 height:80
(
 spinner conunt_spn1 "" pos:[152,25] width:12 height:16  range:[1,6,1] type:#integer
 edittext conunt_edt1 "" pos:[3,25] width:147 height:16 text:"Z軸的負方向" enabled:false
 button pick_btn1 "開始對齊" pos:[6,49] width:142 height:24
 groupBox grp1 "軸向選擇:" pos:[5,9] width:160 height:39
 on conunt_spn1 changed arg  do
 (
  new_obj = case arg of

  (

  1: conunt_edt1.text="Z軸的負方向"

  2: conunt_edt1.text="Z軸的正方向"
   
  3: conunt_edt1.text="X軸的負方向"
   
  4: conunt_edt1.text="X軸的正方向"
   
  5: conunt_edt1.text="Y軸的負方向"
   
  6: conunt_edt1.text="Y軸的正方向"

  --default: reference $foo

  )

 )
 
 
 on pick_btn1 pressed do
(
 target_mesh = pickObject message:"Pick Target Surface:" filter:g_filter --- 這種拾取的方法更好。不用再顯示;
 if isValidNode target_mesh then ---這個好用, 是如果節點沒有被刪除。
 (
  undo "MoveToSurface" on
  (
   for i in selection do
   (
    int_point = find_intersection target_mesh i
    if int_point != undefined then i.pos = int_point.pos
   )--end i loop
  )--end undo
 )--end if
)--end pressed
  
 
)
createdialog gt_yc_Ail style:#(#style_border,#style_titlebar,#style_resizing,#style_sysmenu)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.