ponchote 发表于 2022-7-6 21:51:58

要处理的地块线

我需要开发一些东西来加速剪切文件的过程。
 
在这些片段中,我有很多单条线,叫做狭缝,我需要在某种块中进行转换,这些块必须是形状的一部分。请看图片和附件。我不确定在VBA上尝试是不是一个好主意,或者Lisp可能会有所帮助。
 
有什么想法或帮助吗?提前谢谢。
线路开口。图纸

Hippe013 发表于 2022-7-6 22:04:04

你是想把白线工作改成绿线工作吗?意思在白线作品中,微小的狭缝表示为一条多段线,而在绿线作品中,它们表示为两条相距0.02个单位且平行的多段线。请问这是做什么用的?你在画什么?
 
算法思想。
 
1.使用bpoly回溯每个项目的内部-将此多段线称为a。(向内突出的单行不会被bpoly拾取,因此不是多段线a的一部分。)
 
2.对于原始的每条多段线,查看是否有任何点位于多段线A内。如果找到一条,我们知道这是一条向内突出的直线。把这一点称为1。
 
3.从该点1(位于多段线A内)获取到其下一个值(点温度)的角度,向右加90度,取0.02个单位,并将该点称为2。
 
4.从点1到点2画一条线。从点2沿点1到点temp的角度前进,并与多段线A相交。将此点称为3。从点2到点3画一条线。
 
5、再做一个动作。将其称为多段线B。这将是您要查找的结果多段线。如果需要,分解多段线B。
 

 
红色多段线是多段线A。

BIGAL 发表于 2022-7-6 22:19:23

Hippe013可能全部分解,使bpoly像你说的那样,向内偏移使用ssget“F”(偏移点列表)选择集将返回所有单独的狭缝线和信息,如线的角度。需要L&R偏移加上结束,然后修剪bpoly并添加3个新的支腿,可能只是使用圆角添加狭缝。我有一个两条线的相交例程和一个是否接触的普林线。

ponchote 发表于 2022-7-6 22:27:50

这些锉刀是用来在喷水机上切割这些形状的,但是如果我把锉刀装上机器转动的缝隙,然后打开每个缝隙上的水泵,然后加工缝隙,我们在形状周围制作一条线,切割过程更快更好。
 
向左或向右偏移可以工作。020不是什么大问题事实上我
进行横向偏移并连接平行线。。不幸的是,一个接一个。相信我一点都不好玩

BIGAL 发表于 2022-7-6 22:41:44

斗篷这是一个有点时间把一些东西,它的阳光,所以我去钓鱼,而不是写代码。

BIGAL 发表于 2022-7-6 22:48:17

这是一个开始,需要一些清理,但它的工作,它将根据需要创建一个新的pline创建多个形状。但它有时会出错。
 
发现只是放大一点,它不喜欢缩小时,采摘里面。
 
斗篷你必须在跑步前引爆!我希望你还有一些问题。
 

; pline co-ords example
; By Alan H
(defun getcoords (ent)
(vlax-safearray->list
(vlax-variant-value
(vlax-get-property
(vlax-ename->vla-object ent)
"Coordinates"
)
)
)
)
; convert now to a list of xy as co-ords are x y x y x y if 3d x y z x y z
(defun co-ords2xy ( / xy)
(setq len (length co-ords))
(setq numb (/ len 2)) ; even and odd check required
(setq I 0)
(repeat numb
(setq xy (list (nth i co-ords)(nth (+ I 1) co-ords) ))
(setq co-ordsxy (cons xy co-ordsxy))
(setq I (+ I 2))
)
) ; co-ords2xy

; rule 1 is that start point is always on pline
; draw two lines so convex or concave works
(defun ah:slit (obj obj1 / ent10 ent11 pt1 pt2 pt3 pt4 pt5 pt6 obj2 obj3 intpt1 intpt2)
(setq ent10 (assoc 10 (entget obj)))
(setq pt1 (list (cadr ent10)(caddr ent10)))
(setq ent11 (assoc 11 (entget obj)))
(setq pt2 (list (cadr ent11)(caddr ent11)))
(setq ang (angle pt2 pt1))
(setvar "osmode" 0)
(setq pt3 (polar pt2 (+ (/ pi 2.0) ang) 0.02))
(setq pt4 (polar pt2 (- ang (/ pi 2.0) ) 0.02))
(setq pt5 (polar pt3 ang 1))
(setq pt6 (polar pt4 ang 1))
(command "line" pt6 pt4 "")
(setq obj2 (vlax-ename->vla-object (entlast)))
(command "line" pt5 pt3 "")
(setq obj3 (vlax-ename->vla-object (entlast)))
(setq intpt1 (vlax-invoke obj2 'intersectWith obj1 acExtendnone))
(setq intpt2 (vlax-invoke obj3 'intersectWith obj1 acExtendnone))
(command "_break" pickobj intpt1 intpt2)
;(command "erase" obj "") ; this is the original line if want to delete
(vla-delete obj2)
(vla-delete obj3)
(command "pline" intpt1 pt4 pt3 intpt2 "")
(setq obj2 (entlast))
(command "pedit" pickobj "j" obj2 "" "")
(princ)
) ; defun

; starts here
; explode shape then premake bpoly
(defun c:mkslit ( / pt0 pickobj obj1 obj ss co-ordsxy)
(command "-layer" "m" "poly" "c" 1 "poly" "")
(setq pt0 (getpoint "pick inside shape"))
(command "_bpoly" pt0 "")
(setq pickobj (entlast)) ; pick bpoly this should be done once only
(setq obj1 (vlax-ename->vla-object pickobj)) ; convert to vl object needed for intersect
(command "offset" 0.05 pickobj pt0 "")
(setq co-ords (getcoords (entlast)))
(princ (co-ords2xy))
(command "erase" (entlast) "")
(setq ss (ssget "_CP" co-ordsxy (list (cons 0 "line"))))
(repeat (setq x (sslength ss))
(setq obj (ssname ss (setq x (- x 1))))
(ah:slit obj obj1)
) ; repeat
(princ)
) ; mkslit

(c:mkslit) ; 1st time run on load

BIGAL 发表于 2022-7-6 22:58:26

雨披你试过了吗?花了一点时间把它放在一起很高兴知道它为你工作,请回复。
页: [1]
查看完整版本: 要处理的地块线