实现这一点的工具是简单的查找pline co ords程序,见下文。对于一个简单的步骤,其他人稍后将编写代码,将1个对象放入块中,确保您有正确的插入点。
使用ssget pick all pline重复查看每个pline,并获得第一个co ord X Y,这与块插入点匹配。然后插入你的区块,我建议换一层。
- ; pline co-ords example
- ; By Alan H
- (defun getcoords (ent)
- (vlax-safearray->list
- (vlax-variant-value
- (vlax-get-property
- obj
- "Coordinates"
- )
- )
- )
- )
- ; program starts here
- (defun c:AHPL-BLK ( / ss x co-ords co-ords2xy)
- (setq ss (ssget (list (cons 0 "Lwpolyline"))))
- (repeat (setq x (sslength ss))
- (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
- (setq co-ords (getcoords obj))
- (setq pt (list (nth 0 co-ords) (nth 1 co-ords)))
- (command "-insert" "yourblockname" pt 1 1 0)
- )
- )
|