(defun C:CD1 ( / ent ob @p1 st en L1 L2 L3 L4 pm)
(vl-load-com) ;;å è½½vlaxæ©å±å½æ°
(setq ent (entsel "\n请éæ©å¤æ®µçº¿"))
(if (/= ent nil)
(progn
(setq ent (car ent))
(Setq ob (Vlax-Ename->Vla-Object ent) ;;转æ¢ä¸ºVLA对象
@p1 (getpoint "\n请éæ©ç¬¬ä¸ç¹")
@p1 (vlax-curve-getclosestpointto ob @p1);;å¾å°è·ç¦»å¤æ®µçº¿ä¸éæ©ç¹æè¿çç¹
@p2 (getpoint "\n请éæ©ç¬¬äºç¹")
@p2 (vlax-curve-getclosestpointto ob @p2);;å¾å°è·ç¦»å¤æ®µçº¿ä¸éæ©ç¹æè¿çç¹
st (Vlax-curve-getStartPoint ob) ;;åå¾æ²çº¿å¼å§ç¹
en (Vlax-curve-getEndPoint ob);;åå¾æ²çº¿ç»æç¹
L1 (Vlax-curve-getDistAtpoint ob en);;åå¾æ²çº¿é¿åº¦
L2 (Vlax-curve-getDistAtpoint ob @p1);;åå¾æ²çº¿èµ·ç¹å°æå®ç¹çé¿åº¦
L3 (Vlax-curve-getDistAtpoint ob @p2);;åå¾æ²çº¿èµ·ç¹å°æå®ç¹çé¿åº¦
L4 (abs (- L2 L3));;åå¾æå®ä¸¤ç¹ä¹é´çå¤æ®µçº¿é¿åº¦
pm (vlax-curve-getPointAtDist ob (* L1 0.5));;åå¾æ²çº¿ä¸ç¹
)
(princ L4);;å½ä»¤è¡æ¾ç¤ºæå®ä¸¤ç¹çå¤æ®µçº¿é¿åº¦
)
);;è¦åå¾è¿ä¸ªèµ·ç¹ä¸è¿ä¸ªç¹çé¿åº¦è¿ä¸ªç¹ä»£å
¥L1å³å¯;å¦å¤å°éå¤æ®µçº¿ååä¸è½å¤ä½¿ç¨è¿ä¸ªå½æ°ãå
¶å®çå弧ï¼æ²çº¿ï¼ä¸å°éçå¤æ®µçº¿åç´çº¿å¯ä»¥ä½¿ç¨è¿ä¸ªå½æ°ã
(princ)
)
追é®ä¸ºä»ä¹å è½½æ¶ä¼æ示å¦ä¸é误ï¼å°ä¸è¿°ä»£ç å为*.lspç¨åºå è½½è¿è¡ï¼ï¼
çæ¬ï¼CAD2006
è¿è¡åé¦å¦ä¸ä¿¡æ¯ï¼
å½ä»¤: AP
APPLOAD å·²æåå è½½ CD1.lspã
å½ä»¤: ; é误: åæ°ç±»åé误: numberp: nil