nest1291 发表于 2022-7-5 15:10:35

喂~,你能看看这个吗

嗨,很荣幸见到你。
 
我正在寻找像这张图片一样的autoLisp。
 
我求你了。上帝保佑你。
 
请与我联系。

ReMark 发表于 2022-7-5 15:16:31

图像中描绘的三个原始形状是由直线还是多段线组成?

Lee Mac 发表于 2022-7-5 15:19:30

这看起来很有趣

(defun c:segoff ( / a b d e i l n p s v x y z )
   (initget 6)
   (if (and (setq d (getdist "\nSpecify offset: "))
            (setq s (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1) (-4 . "<NOT") (-4 . "<>") (42 . 0.0) (-4 . "NOT>"))))
       )
       (repeat (setq i (sslength s))
         (setq i (1- i)
               e (ssname s i)
               x (entget e)
               p (LM:defaultprops x)
               z (list (cdr (assoc 38 x)))
               l nil
         )
         (while (setq v (assoc 10 x))
               (setq l (cons (append (cdr v) z) l)
                     x (cdr (member v x))
               )
         )
         (setq n (/ pi (if (LM:listclockwise-p l) 2 -2)))
         (mapcar
            '(lambda ( x y / a b )
                   (setq a (+ (angle x y) n)
                         b (list x (polar x a d) (polar y a d) y)
                   )
                   (mapcar
                      '(lambda ( a b )
                           (entmake (vl-list* '(0 . "LINE") (cons 10 (trans a e 0)) (cons 11 (trans b e 0)) p))
                     )
                     b (cdr b)
                  )
               )
               (cons (last l) l) l
         )
       )
   )
   (princ)
)

;; List Clockwise-p - Lee Mac
;; Returns T if the point list is clockwise oriented

(defun LM:listclockwise-p ( lst )
   (minusp
       (apply '+
         (mapcar
               (function
                   (lambda ( a b )
                     (- (* (car b) (cadr a)) (* (car a) (cadr b)))
                   )
               )
               lst (cons (last lst) lst)
         )
       )
   )
)

;; Default Properties-Lee Mac
;; Returns a list of DXF properties for the supplied DXF data,
;; substituting default values for absent DXF groups

(defun LM:defaultprops ( enx )
   (mapcar '(lambda ( x ) (cond ((assoc (car x) enx)) ( x )))
      '(
         (006 . "BYLAYER")
         (008 . "0")
         (039 . 0.0)
         (048 . 1.0)
         (062 . 256)
         (370 . -1)
       )
   )
)

(princ)

ronjonp 发表于 2022-7-5 15:22:03

很好,李

Lee Mac 发表于 2022-7-5 15:26:02

 
干杯,罗恩

hanhphuc 发表于 2022-7-5 15:29:21

丹尼尔?
 
@不错的李香草
 
VL-我认为速度较慢,可以接受带有凸起/圆弧的多段线

known bug - sometimes arc offset wrong direction

(defun c:offs ( / xy ob s d i l )
(prompt "\nSelect closed polylines ")
   (and (setq s (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))
      (progn (initget 7)
          (setq xy '((l)(if l (cons (list (car l)(cadr l)) (xy (cddr l)))))
         d (getdist "\nSpecify offset: "))
)
(repeat (setq i (sslength s))
   (setq ob (vlax-ename->vla-object (ssname s (setq i (1- i))))
   l (xy (vlax-get ob 'coordinates))
)
       (mapcar '(lambda (x / o )
             (mapcar
                ''((f) (setq f (eval (read (strcat "vlax-curve-get" f )))
                             o (vlax-invoke x 'offset
                                ((if ( LM:listclockwise-p l )
                                   + -
                                 )
                                 d
                                )
                              )
                          )
                     (entmakex (list '(0 . "LINE")(cons 10 (f x ))(cons 11 (f (car o)))))
                   )
              '( "startpoint" "Endpoint" )
             )
           (vla-erase x)
          )
      (vlax-invoke ob 'explode)
) ;mapcar
   ) ; repeat
) ;and
(princ)
)

nest1291 发表于 2022-7-5 15:29:57

 
 
非常感谢你!!!谢谢谢谢谢谢。我想解释一下我的心情,但我的英语水平很低。。。。谢谢,谢谢。
 
还有一个问题。。
 
我必须将除原始多边形之外的层更改为我创建的特定层。
 
再次感谢你。我恳求你的帮助。

marko_ribar 发表于 2022-7-5 15:35:05

@hanhphuc公司
 
但你已经知道了。。。
 

BrianTFC 发表于 2022-7-5 15:38:26

marko_ribar,
 
我尝试将DXF代码008设置为我希望选项卡成为的层,但它不会改变它们,我做错了什么?
 
谢谢
布瑞恩

marko_ribar 发表于 2022-7-5 15:41:58

如果您正在引用(LM:defaultprops),请不要更改代码中的任何内容。。。在执行例程之前,您必须将操作的参考LWPOLYLINE设置为您想要的图层。。。
页: [1] 2
查看完整版本: 喂~,你能看看这个吗