|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 _1 O1 u) O& k& X, h- j# k# ?NX二次开发源码分享:测量两个对象之间最短距离
, r0 H7 t9 Y3 S# T1 n( s& @7 w/ r/ W |$ O4 A
[mw_shl_code=csharp,true] Dim theSession As Session = Session.GetSession()
% B0 w7 n& d) i% ` Dim workPart As Part = theSession.Parts.Work( A* M, n8 m1 k
; r( Y, L1 q; v- G4 U6 ] Dim object1 As DisplayableObject = SelectAnObject("First Object")- s& l5 y$ c, C5 L# i; e( A! ]' |$ W
Dim object2 As DisplayableObject = SelectAnObject("Second Object")
4 I4 s3 c3 S$ j2 L4 s6 h' k) e0 S/ z& h
$ L' v0 u8 z5 w# k- a, e" F
+ Y4 \5 q2 m! x' y Dim unitMM As Unit = CType(workPart.UniTCollection.FindObject("MilliMeter"), Unit) I2 g& }# j. a7 U4 x
Dim nullUnit As Unit = Nothing
$ k# W- [7 \& e+ P Dim measureDistance1 As MeasureDistance
" U# j) d1 p- j" v
. Y) l$ S0 O. x$ b1 S! l# | measureDistance1 = workPart.MeasureManager.NewDistance(nullUnit,/ J3 k n; K9 o! i) k! c
MeasureManager.MeasureType.Maximum, object1, object2)3 k2 Q. s* j7 G7 H
0 ^1 ^ f, Z& K, P2 x( \% y
Dim theLW As ListingWindow = theSession.ListingWindow: N8 j, @6 w% B; ~/ j' b- U6 o* \* I
theLW.Open()
4 S0 ~3 R0 j8 Z& S* {7 Q theLW.WriteLine("Maximum distance = " & measureDistance1.Value.ToString("F6"))
7 I2 F$ w E: J3 g
! F: t& L" f% m( b: ?' `5 x1 @& m3 j/ J" o+ M0 C
measureDistance1.Dispose()[/mw_shl_code]
! B+ |, C! p1 g2 [& g |
|