[已解决]根据多段线点表,重新生成开放多段线
本帖最后由 yu960312 于 2024-5-3 19:27 编辑;;多段线点表
(setq point_list_new '(((37225.7 856.217 0.0) 0.0) ((37225.7 854.217 0.0) 0.0) ((37208.7 854.217 0.0) 0.0) ((37205.7 857.217 0.0) 0.0) ((37205.7 864.217 0.0) -0.414214) ((37206.7 865.217 0.0) 0.0) ((37209.7 865.217 0.0) 0.414214) ((37210.7 866.217 0.0) 0.0) ((37210.7 872.217 0.0) 0.414214) ((37209.7 873.217 0.0) 0.0) ((37206.7 873.217 0.0) -0.414214) ((37205.7 874.217 0.0) 0.0) ((37205.7 881.217 0.0) -0.414214)))
;;重新生成开放多段线?不知为何会生成首尾封闭的多段线
(entmake (append(list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length point_list_new)) (cons 70 0))(foreach p point_list_new(setq a (list (cons 10 (car p))))(setq ptll (append ptll a))(setq a (list (cons 42 (cadr p))))(setq ptll (append ptll a)))))
;;多段线点表
[*](setq point_list_new '(((37225.7 856.217 0.0) 0.0) ((37225.7 854.217 0.0) 0.0) ((37208.7 854.217 0.0) 0.0) ((37205.7 857.217 0.0) 0.0) ((37205.7 864.217 0.0) -0.414214) ((37206.7 865.217 0.0) 0.0) ((37209.7 865.217 0.0) 0.414214) ((37210.7 866.217 0.0) 0.0) ((37210.7 872.217 0.0) 0.414214) ((37209.7 873.217 0.0) 0.0) ((37206.7 873.217 0.0) -0.414214) ((37205.7 874.217 0.0) 0.0) ((37205.7 881.217 0.0) -0.414214)))
;;重新生成开放多段线
[*](entmake (append(list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (- (length point_list_new) 1)) (cons 70 0))
[*](foreach p point_list_new
[*](setq a (list (cons 10 (car p))))
[*](setq ptll (append ptll a))
[*](setq a (list (cons 42 (cadr p))))
[*](setq ptll (append ptll a))
[*])
[*])
[*])
试试这样
(entmake (append(list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length point_list_new)) (cons 70 1))(foreach p point_list_new(setq a (list (cons 10 (car p))))(setq ptll (append ptll a))(setq a (list (cons 42 (cadr p))))(setq ptll (append ptll a))))) ssyfeng 发表于 2024-5-3 19:31
试试这样
(entmake (append(list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (c ...
解决了
(cons 90 (- (length point_list_new) 1))
页:
[1]