马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 marting 于 2017-2-9 11:48 编辑
1、命令方法
(command "-hatchedit" OBJ "b" "r" "y")
2、VLISP方法
(defun c:ReBound (/ loops layerN HObjts Hobj_ Hobj_VLA lpNum)
(defun AT:Test (ent layer / _2dpt layer ss i a b ss2 i2 d)
(vl-load-com)
(defun _2dpt (pt) (list (car pt) (cadr pt) 0.))
(vla-getboundingbox (vlax-ename->vla-object ent) 'a 'b)
(if (setq ss2
(apply
'ssget
(append
(list "_W")
(mapcar
'(lambda (x) (trans (_2dpt (vlax-safearray->list x)) 0 1))
(list a b)
)
'(((0 . "~HATCH,ARC,CIRCLE,LINE,LWPOLYLINE")))
)
)
)
(repeat (setq i2 (sslength ss2))
(entmod
(subst
(cons 8 layer)
(assoc 8 (setq d (entget (ssname ss2 (setq i2 (1- i2))))))
d
)
)
)
)
(princ)
)
(defun Loops (lpn Vlnme EntN Lynm / BndL)
(vla-GetLoopAt Vlnme lpn 'lp)
(if (vl-catch-all-error-p
(setq BndL (vl-catch-all-apply
'vlax-safearray->list
(list lp)
)
)
)
(progn
(command "_-HATCHEDIT" EntN "_B" "_P" "_Y")
(AT:Test EntN Lynm)
)
(foreach itm BndL
(vla-put-layer itm Lynm)
)
)
)
(prompt "\nSelect Hatch for Boundary:")
(setq HObjts (ssget ":L" '((0 . "HATCH"))))
(repeat (setq i (sslength HObjts))
(setq Hobj_ (ssname HObjts (setq i (1- i))))
(setq Hobj_VLA (vlax-ename->vla-object Hobj_))
(if (= (setq lpNum (vla-get-numberofloops Hobj_VLA)) 1)
(loops 0 Hobj_VLA Hobj_ (vla-get-layer Hobj_VLA))
(progn
(setq lp_ -1)
(repeat lpNum
(loops (setq lp_ (1+ lp_)) Hobj_VLA Hobj_ layerN)
)
)
)
)
(princ)
)
HATCH填充的数据格式:Hatch boundary path data group codes | Group code | Description | | Boundary path type flag (bit coded): 0 = Default; 1 = External; 2 = Polyline 4 = Derived; 8 = Textbox; 16 = Outermost | | Polyline boundary type data (only if boundary = polyline). See Polyline boundary data table below | | Number of edges in this boundary path (only if boundary is not a polyline) | | Edge type (only if boundary is not a polyline): 1 = Line; 2 = Circular arc; 3 = Elliptic arc; 4 = Spline | | Edge type data (only if boundary is not a polyline). See appropriate Edge data table below | | Number of source boundary objects | | Reference to source boundary objects (multiple entries) |
Polyline boundary data group codes | Group code | Description | | | | | | Number of polyline vertices | | Vertex location (in OCS) DXF: X value; APP: 2D point (multiple entries) | | DXF: Y value of vertex location (in OCS) (multiple entries) | | Bulge (optional, default = 0) |
Line edge data group codes | Group code | Description | | Start point (in OCS) DXF: X value; APP: 2D point | | DXF: Y value of start point (in OCS) | | Endpoint (in OCS) DXF: X value; APP: 2D point | | DXF: Y value of endpoint (in OCS) |
Arc edge data group codes | Group code | Description | | Center point (in OCS) DXF: X value; APP: 2D point | | DXF: Y value of center point (in OCS) | | | | | | | | |
Ellipse edge data group codes | Group code | Description | | Center point (in OCS) DXF: X value; APP: 2D point | | DXF: Y value of center point (in OCS) | | Endpoint of major axis relative to center point (in OCS) DXF: X value; APP: 2D point | | DXF: Y value of endpoint of major axis (in OCS) | | Length of minor axis (percentage of major axis length) | | | | | | |
Spline edge data group codes | Group code | Description | | | | | | | | | | | | Knot values (multiple entries) | | Control point (in OCS) DXF: X value; APP: 2D point | | DXF: Y value of control point (in OCS) | | Weights (optional, default = 1) | | | | Fit datum (in OCS) DXF: X value; APP: 2D point | | DXF: Y value of fit datum (in OCS) | | Start tangent DXF: X value; APP: 2D vector | | DXF: Y value of start tangent (in OCS) | | End tangent DXF: X value; APP: 2D vector | | DXF: Y value of end tangent (in OCS)
|
|