例如,或示例:
这是一个子功能,是更大例程的一部分
- (defun MySub (a1 a2 a3 insertpt1 / OBJ P2 P3 ) ;subfunction
- (vl-load-com) ;load vlisp functions
- (if (= objx 1) ;if objx is 1, ent=line or pline
- (progn ;preform these actions
- (setvar "osmode" 0) ;first turn off osnap
- [b](command "._insert" a1 insertpt1 "" "" [color=royalblue]pause[/color])[/b] ;insert into space
- (hms:attrt)
- (princ)
- (if (> a2 0.0) ;if trim dist is greater than 0.0 preform
- (progn ;these actions
- (setq obj (vlax-ename->vla-object name)) ;get entity object
- (if (eq (vla-get-ObjectName obj) "AcDbPolyline") ;if it is a LwPolyline
- (setq p3 insertpt1 ;get first break point
- p2 (angle insertpt1 (vlax-curve-getpointatparam obj (fix (vlax-curve-getparamatpoint obj insertpt1)))))
- (setq p3 insertpt1 ;and second break point
- p2 (angle (vlax-curve-getStartpoint obj) (vlax-curve-getEndPoint obj)))
- ) ;if
- (command "break" name (polar p3 p2 a2) (polar p3 p2 a3)) ;break line
- ) ;progn
- (princ "\n......Selected....\n......Breaking Lines....") ;status
- ) ;if
- )
- (progn
- [b] (command "._insert" a1 insertpt1 "" "" pause)[/b] ;insert onto line
- (hms:attrt)
- (princ)
- )
- ) ;if
- (princ "\n......Insertion Completed!") ;print clear to screen
- (princ) ;print clear
- ) ;MySub
也许这会有用。 |