CAD technology has been widely used in various professional designs, but commercial software is insufficient in the field of chemical process design. This requires each design unit to develop its own application software to adapt to the development of CAD technology. The valve drawing program provided in this article is in AutoCAD secondary An independent program in the CPCAD system of the chemical process computer-aided design of the development. It is written in AutoLisp language, it is full-featured, easy to use, readable and has certain skills.
â— Valve drawing requires drawing the valve on AutoCAD. It is required to automatically display a certain proportion on the existing process pipeline according to the valve type. The size of the drawing output meets the requirements of professional drawing, (? The reason is impossible according to the actual size of the valve Drawing at the same scale as other chemical equipment) and automatically cutting the pipeline, at the same time judging the angle between the pipeline and the horizontal direction, can replace AutoCAD copy. The valve type is complete, and the layer is automatically set without being affected by the original current layer.
â— Program introduction This program provides 11 kinds of commonly used valve types according to the above requirements, which can be conveniently selected. If other types are needed, the source program can be modified and supplemented simply.
1. Main control program In the main control program, (if (and (/ = * bl nil) (/ = *? Dwgscale? Nil)?)? Determine whether the variables * bl and * dwgscal exist. Execute, so it needs to be loaded in ACAD.?LSP? Or assigned under command (Note: * bl = * dwgscale). For example, (setq * bl 100) (setq * dwgscale 100) ?, 100 is the drawing scale. Complete the layer setting in the paragraph. The following default values ​​are designed for readers to analyze by themselves. They have versatility and certain skills.
2. The common subroutine of the valve program This part is the core of the program. The value of the valve length is 5 times of the drawing scale, and the length is 5mm when output in the same scale. The drawing of the flange is optional. When prompted for the position of the valve core, select the line entity. The program can calculate the angle between the line and the horizontal direction for the starting and ending coordinates of the selected line entity. At the same time, find the polar coordinates of each drawing point. What needs to be emphasized is that it is not applicable to the Pline polyline. The reason is that the connection between the start point and the end point is inconsistent with the valve to be drawn. (Generally, if you need thick lines, you can set the parameters of the plotter when drawing)? This subroutine calls the flange design subroutine, which is allowed by AutoLisp, and is a good function.
3. Other subroutines are relatively simple and will not be introduced again.
â—. Attached source program list VA
(defun * ERROR * (st)
(menucmd "s = s")
(command "osnap" "none")
(command "layer" "s" cl "")
(setvar "regenmode" 1)
(princ st)
(terpri)
)
(defun qs ()
(setq fc (* 5.0 * bl))
(menucmd "s = s")
(initget "YN")
(if (not * yffl) (setq * yffl "N"))
(princ "Are there flanges: [Y / N] <")
(princ * yffl)
(setq fl (getkword ">"))
(if (not fl) (setq fl * yffl) (setq * yffl fl))
) (defun dfw ()
(command "OSNAP" "NEAR")
(setq e1 (entsel "Spool position:"))
(command "osnap" "none")
(defun gy ()
(setq zx (cadr e1)
e2 (entget (car e1))
p01 (cdr (assoc 10 e2))
p02 (cdr (assoc 11 e2))
zj (+ (* (/ 1.0 2.0) pi) (angle p01 p02))
l1 (/ fc 1.732)
l2 (/ l1 1.0)
p1 (polar zx (+ zj (* (/ 2.0 3.0) pi)) l2)
p2 (polar zx (+ zj (* (/ 1.0 3.0) pi)) l2)
p3 (polar zx (+ zj (* (/ 4.0 3.0) pi)) l2)
p4 (polar zx (+ zj (* (/ 5.0 3.0) pi)) l2)
p11 (polar zx (+ zj (* (/ 1.0 2.0) pi)) (* 0.867 l2))
p21 (polar zx (+ zj (* (/ 2.0 3.0) pi)) (* 0.48 l1))
p22 (polar zx (+ zj (* (/ 1.0 3.0) pi)) (* 0.48 l1))
p23 (polar zx (+ zj (* (/ 4.0 3.0) pi)) (* 0.48 l1))
p24 (polar zx (+ zj (* (/ 5.0 3.0) pi)) (* 0.48 l1))); setq
(flsz)
(command "break" p32 p33)
)
(defun qf ()
(while e1
(gy)
(command "line" p21 p1 p2 p22 ""
"line" p23 p3 p4 p24 ""
"circle" zx (* 0.48 l1)); command
(dfw)
); While
(PRINC)
)
(defun jz ()
(while e1
(gy)
(command "line" p1 p2 p3 p4 p1 "")
(dfw)
(PRINC)
)
)
(defun zf ()
(while e1
(gy)
(setq l3 (/ l2 2)
p7 (polar zx (+ zj (* (/ 1.0 1.0) pi)) l3)
p8 (polar zx (+ zj (* (/ 0.0 1.0) pi)) l3)); setq
(command "line" p1 p2 p3 p4 p1 ""
"line" p7 p8 ""); command
(dfw)
(PRINC)); while
)
(defun dx ()
(while e1
(gy)
(command "line" p1 p2 p3 p4 p1 ""
"solid" zx p3 p4 "" ""); command
(xzjd)
(command "rotate" "c" p2 p3 "" zx zj)
(dfw)
)
(PRINC)
)
(defun xzjd ()
(initget "YN")
(if (not * xz) (setq * xz "N"))
(princ "Mirror rotation: [Y / N] <")
(princ * xz)
(setq xz (getkword ">"))
(if (not xz) (setq xz * xz) (setq * xz xz))
(if (= xz "N") (setq zj 0.0) (setq zj 180.0))
) (defun xs ()
(while e1
(gy)
(command "line" p1 p2 p3 p4 p1 ""
"donut" 0 (* 0.8 l1) zx ""); command
(dfw)
); While
(PRINC)
)
(defun jl ()
(while e1
(gy)
(command "line" p1 p2 p3 p4 p1 ""
"solid" zx p3 p4 "" ""
"solid" zx p1 p2 "" ""); command
(dfw)
); While
(PRINC)
)
(defun jy ()
(while e1
(gy)
(command "line" p1 p3 p4 p2 p1 ""
"line" p3 p11 p4 ""); command
(xzjd)
(command "rotate" "c" p2 p3 "" zx zj)
(dfw)
); While
(PRINC)
)
(defun gm ()
(while e1
(gy)
(setq p44 (polar zx (+ zj (* 0.0 pi)) (* 0.6 l1)))
(command "line" p1 p2 p3 p4 p1 ""
"arc" p24 p44 p22); command
(dfw)
); While
(PRINC)
) (defun df ()
(while e1
(gy)
(command "line" p1 p3 p4 p2 p1 ""
"circle" zx (* 0.5 l1)); command
(dfw)
); While
(PRINC)
)
(defun ss ()
(while e1
(gy)
(setq p55 (polar zx (* 0.25 pi) (* 0.45 fc))
p56 (polar zx (* 1.25 pi) (* 0.45 fc))
p57 (polar zx (* 1.25 pi) (* 0.225 fc))); setq
(command "pline" p57 "w" (* 0.45 fc) "" "a" "ce" zx "a" 180 ""
"line" p55 p56 ""
"circle" zx (* 0.45 fc)); command
(dfw)
); While
(PRINC)
)
(defun kz ()
(while e1
(gy)
(setq k1 (polar zx zj (* l2 0.7))
kzx (polar zx zj (* l2 0.35))
k2 (polar k1 (+ zj (* (/ 1.0 2.0) pi)) (/ l2 2.0))
k3 (polar k1 (+ zj (* (/ 3.0 2.0) pi)) (/ l2 2.0))
k4 (polar k1 zj (/ l2 2.0))); setq
(command "line" p1 p2 p3 p4 p1 ""
"line" k2 k3 ""
"line" k1 zx ""
"arc" k2 k4 k3); command
(xzjd)
(command "rotate" "c" kzx k4 "" zx zj)
(dfw)
); While
(PRINC)
)
(defun flsz ()
(if (= fl "Y")
(progn
(setq p32 (polar zx (+ zj (* (/ -1.0 2.0) pi)) (* 3.0 * bl))
p33 (polar zx (+ zj (* (/ 1.0 2.0) pi)) (* 3.0 * bl))
pf1 (polar p32 (+ zj (* 0.0 pi)) (* 0.5 l1))
pf2 (polar p32 (+ zj (* 1.0 pi)) (* 0.5 l1))
pf3 (polar p33 (+ zj (* 1.0 pi)) (* 0.5 l1))
pf4 (polar p33 (+ zj (* 0.0 pi)) (* 0.5 l1))); setq
(command "break" p32 p33 "line" pf1 pf2 ""
"line" pf3 pf4 ""); command
); Progn
(setq p32 (polar zx (+ zj (* (/ -1.0 2.0) pi)) l2)
p33 (polar zx (+ zj (* (/ 1.0 2.0) pi)) l2)); setq
); If
(princ)
)
(defun va ()
(if (and (/ = * bl nil) (/ = * dwgscale nil))
(progn
(setvar "cmdecho" 0)
(setvar "regenmode" 0)
(setq cl (getvar "clayer"))
(command "blipmode" "off"
"fill" "on"
"layer" "m" "va" "s" "va"
"lt" "conTInuous" "" "c" "green" "" ""); command
(initget "QZJDXLYGWSK")
(if (not * fm) (setq * fm "J"))
(princ "ball Q / brake Z / cut J / single D / spin X / node L / minus Y / part G / butterfly W / sparse S / control K <")
(princ * fm)
(setq fm (getkword ">:"))
(if (not fm) (setq fm * fm) (setq * fm fm))
(cond ((= fm "Q") (qs) (dfw) (qf))
((= fm "Z") (qs) (dfw) (zf))
((= fm "J") (qs) (dfw) (jz))
((= fm "D") (qs) (dfw) (dx))
((= fm "X") (qs) (dfw) (xs))
((= fm "L") (qs) (dfw) (jl))
((= fm "Y") (qs) (dfw) (jy))
((= fm "G") (qs) (dfw) (gm))
((= fm "W") (qs) (dfw) (df))
((= fm "S") (qs) (dfw) (ss))
((= fm "K") (qs) (dfw) (kz))); cond
(command "layer" "s" cl "")
(setvar "regenmode" 1)
(princ)
)
)
); End
(va)
princ)
)
)
); End
(va)
ZGAR bar 2000 Puffs
ZGAR electronic cigarette uses high-tech R&D, food grade disposable pod device and high-quality raw material. All package designs are Original IP. Our designer team is from Hong Kong. We have very high requirements for product quality, flavors taste and packaging design. The E-liquid is imported, materials are food grade, and assembly plant is medical-grade dust-free workshops.
Our products include disposable e-cigarettes, rechargeable e-cigarettes, rechargreable disposable vape pen, and various of flavors of cigarette cartridges. From 600puffs to 5000puffs, ZGAR bar Disposable offer high-tech R&D, E-cigarette improves battery capacity, We offer various of flavors and support customization. And printing designs can be customized. We have our own professional team and competitive quotations for any OEM or ODM works.
We supply OEM rechargeable disposable vape pen,OEM disposable electronic cigarette,ODM disposable vape pen,ODM disposable electronic cigarette,OEM/ODM vape pen e-cigarette,OEM/ODM atomizer device.
ZGAR bar 2000 Puffs Disposable Vape, bar 2000puffs,ZGAR bar 2000 Puffs disposable,ZGAR bar 2000 Puffs,ZGAR bar 2000 Puffs OEM/ODM disposable vape pen atomizer Device E-cig
ZGAR INTERNATIONAL(HK)CO., LIMITED , https://www.oemvape-pen.com