qq112648819 发表于 2024-5-26 10:12:35

求一个可以画冷弯C型钢的插件。

求一个可以画冷弯C型钢的插件。做金属屋经常用到

kozmosovia 发表于 2024-5-26 10:18:40

标准品直接做动态块不香吗?

andymong 发表于 2024-5-26 10:45:17

;;;;绘制C型钢
(defun c:cxg ( / h b c t1 pt0 pt0x pt0y pt0z pt1 pt2 pt3 pt4 pt5 pt6 pt7 pt8 pt9 pt10 pt11 pt12 pt13 pt14 pt15 pt16 pt17 pt18 pt19 pt20)
(princ "\n绘制C型钢")
(command "_.undo" "be")
(setvar "osmode" 0)
(setq h (getreal "\n请输入C型钢高度:"))
(if (= h nil) (setq h 200))
(setq b (getreal "\n请输入C型钢宽度:"))
(if (= b nil) (setq b 70))
(setq c (getreal "\n请输入C型钢卷边尺寸:"))
(if (= c nil) (setq c 20))
(setq t1 (getreal "\n请输入C型钢厚度:"))
(if (= t1 nil) (setq t1 2))
(setq pt0 (getpoint "\n请指定插入点:"))
(setq pt0x (car pt0))
(setq pt0y (cadr pt0))
(setq pt0z (caddr pt0))
(setq pt1 (list (- pt0x (/ b 2)) (+ pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(setq pt2 (list (- pt0x (- (/ b 2) 8)) (+ pt0y (/ h 2)) (+ pt0z 0)))
(setq pt3 (list (+ pt0x (- (/ b 2) 8)) (+ pt0y (/ h 2)) (+ pt0z 0)))
(setq pt4 (list (+ pt0x (/ b 2)) (+ pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(setq pt5 (list (+ pt0x (/ b 2)) (+ pt0y (- (/ h 2) c)) (+ pt0z 0)))
(setq pt6 (list (+ pt0x (- (/ b 2) t1)) (+ pt0y (- (/ h 2) c)) (+ pt0z 0)))
(setq pt7 (list (+ pt0x (- (/ b 2) t1)) (+ pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(setq pt8 (list (+ pt0x (- (/ b 2) 8)) (+ pt0y (- (/ h 2) t1)) (+ pt0z 0)))
(setq pt9 (list (- pt0x (- (/ b 2) 8)) (+ pt0y (- (/ h 2) t1)) (+ pt0z 0)))
(setq pt10 (list (- pt0x (- (/ b 2) t1)) (+ pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(setq pt11 (list (- pt0x (- (/ b 2) t1)) (- pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(setq pt12 (list (- pt0x (- (/ b 2) 8)) (- pt0y (- (/ h 2) t1)) (+ pt0z 0)))
(setq pt13 (list (+ pt0x (- (/ b 2) 8)) (- pt0y (- (/ h 2) t1)) (+ pt0z 0)))
(setq pt14 (list (+ pt0x (- (/ b 2) t1)) (- pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(setq pt15 (list (+ pt0x (- (/ b 2) t1)) (- pt0y (- (/ h 2) c)) (+ pt0z 0)))
(setq pt16 (list (+ pt0x (/ b 2)) (- pt0y (- (/ h 2) c)) (+ pt0z 0)))
(setq pt17 (list (+ pt0x (/ b 2)) (- pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(setq pt18 (list (+ pt0x (- (/ b 2) 8)) (- pt0y (/ h 2)) (+ pt0z 0)))
(setq pt19 (list (- pt0x (- (/ b 2) 8)) (- pt0y (/ h 2)) (+ pt0z 0)))
(setq pt20 (list (- pt0x (/ b 2)) (- pt0y (- (/ h 2) 8)) (+ pt0z 0)))
(command "pline" pt6 "w" "0" "0" pt5 pt4 "a" "r" "8" pt3 "l" pt2"a" "r" "8" pt1 "l" pt20"a" "r" "8" pt19 "l" pt18 "a" "r" "8" pt17 "l" pt16 pt15 "")
(setq ename1 (entlast))
(command "pline" pt6 "w" "0" "0" pt7 "a" "r" "8" pt8 "l" pt9"a" "r" "8" pt10 "l" pt11"a" "r" "8" pt12 "l" pt13 "a" "r" "8" pt14 "l" pt15 pt16 "")
(setq ename2 (entlast))
(command "pedit" ename1 "j" ename2 "" "")
(setvar "osmode" 16383)
(command "_.undo" "e")
(princ)
)

tiancao100 发表于 2024-5-26 12:32:41

    '************************************************************************************************************************
    '
    '11------10
    '   | 6--7 |
    '   | || |
    '   | |8-9
    '   | |
    '   | |
    '   | |3-2
    '   | || |
    '   | 5--4 |
    '   0------1

    Function CXG(ByVal XH As String) As Entity
      XH = XH.ToUpper.Replace("C", "")
      Dim H As Double = Val(XH.Split("X")(0))
      Dim B As Double = Val(XH.Split("X")(1))
      Dim J As Double = Val(XH.Split("X")(2))
      Dim T As Double = Val(XH.Split("X")(3))
      Dim PtBase As Point3d = New Point3d(0, 0, 0)
      Dim P0 As Point2d = New Point2d(PtBase(0), PtBase(1))
      Dim P1 As Point2d = New Point2d(PtBase(0) + B, PtBase(1))
      Dim P2 As Point2d = New Point2d(PtBase(0) + B, PtBase(1) + J)
      Dim P3 As Point2d = New Point2d(PtBase(0) + B - T, PtBase(1) + J)
      Dim P4 As Point2d = New Point2d(PtBase(0) + B - T, PtBase(1) + T)
      Dim P5 As Point2d = New Point2d(PtBase(0) + T, PtBase(1) + T)
      Dim P6 As Point2d = New Point2d(PtBase(0) + T, PtBase(1) + H - T)
      Dim P7 As Point2d = New Point2d(PtBase(0) + B - T, PtBase(1) + H - T)
      Dim P8 As Point2d = New Point2d(PtBase(0) + B - T, PtBase(1) + H - J)
      Dim P9 As Point2d = New Point2d(PtBase(0) + B, PtBase(1) + H - J)
      Dim P10 As Point2d = New Point2d(PtBase(0) + B, PtBase(1) + H)
      Dim P11 As Point2d = New Point2d(PtBase(0), PtBase(1) + H)
      Dim PL As AcDbs.Polyline = New AcDbs.Polyline
      PL.AddVertexAt(0, P0, 0, 0, 0)
      PL.AddVertexAt(1, P1, 0, 0, 0)
      PL.AddVertexAt(2, P2, 0, 0, 0)
      PL.AddVertexAt(3, P3, 0, 0, 0)
      PL.AddVertexAt(4, P4, 0, 0, 0)
      PL.AddVertexAt(5, P5, 0, 0, 0)
      PL.AddVertexAt(6, P6, 0, 0, 0)
      PL.AddVertexAt(7, P7, 0, 0, 0)
      PL.AddVertexAt(8, P8, 0, 0, 0)
      PL.AddVertexAt(9, P9, 0, 0, 0)
      PL.AddVertexAt(10, P10, 0, 0, 0)
      PL.AddVertexAt(11, P11, 0, 0, 0)
      PL.Closed = True
      TcApp.TcFuns.CAD.AddEnt(PL)
      CXG = PL
    End Function

    '7------6
    '|10-11 |
    '| || |
    '8-9| |   
    '       | |
    '       | |
    '       | |3-2
    '       | || |
    '       | 5--4 |
    '       0------1

    Function ZXG(ByVal XH As String) As Entity
      XH = XH.ToUpper.Replace("XZ", "")
      Dim H As Double = Val(XH.Split("X")(0))
      Dim B As Double = Val(XH.Split("X")(1))
      Dim J As Double = Val(XH.Split("X")(2))
      Dim T As Double = Val(XH.Split("X")(3))
      Dim PtBase As Point3d = New Point3d(0, 0, 0)
      Dim P0 As Point2d = New Point2d(PtBase(0), PtBase(1))
      Dim P1 As Point2d = New Point2d(PtBase(0) + B, PtBase(1))
      Dim P2 As Point2d = New Point2d(PtBase(0) + B, PtBase(1) + J)
      Dim P3 As Point2d = New Point2d(PtBase(0) + B - T, PtBase(1) + J)
      Dim P4 As Point2d = New Point2d(PtBase(0) + B - T, PtBase(1) + T)
      Dim P5 As Point2d = New Point2d(PtBase(0) + T, PtBase(1) + T)
      Dim P6 As Point2d = New Point2d(PtBase(0) + T, PtBase(1) + H)
      Dim P7 As Point2d = New Point2d(PtBase(0) + T - B, PtBase(1) + H)
      Dim P8 As Point2d = New Point2d(PtBase(0) + T - B, PtBase(1) + H - J)
      Dim P9 As Point2d = New Point2d(PtBase(0) + T - B + T, PtBase(1) + H - J)
      Dim P10 As Point2d = New Point2d(PtBase(0) + T - B + T, PtBase(1) + H - T)
      Dim P11 As Point2d = New Point2d(PtBase(0), PtBase(1) + H - T)
      Dim PL As AcDbs.Polyline = New AcDbs.Polyline
      PL.AddVertexAt(0, P0, 0, 0, 0)
      PL.AddVertexAt(1, P1, 0, 0, 0)
      PL.AddVertexAt(2, P2, 0, 0, 0)
      PL.AddVertexAt(3, P3, 0, 0, 0)
      PL.AddVertexAt(4, P4, 0, 0, 0)
      PL.AddVertexAt(5, P5, 0, 0, 0)
      PL.AddVertexAt(6, P6, 0, 0, 0)
      PL.AddVertexAt(7, P7, 0, 0, 0)
      PL.AddVertexAt(8, P8, 0, 0, 0)
      PL.AddVertexAt(9, P9, 0, 0, 0)
      PL.AddVertexAt(10, P10, 0, 0, 0)
      PL.AddVertexAt(11, P11, 0, 0, 0)
      PL.Closed = True
      TcApp.TcFuns.CAD.AddEnt(PL)
      ZXG = PL
    End Function

Qwer1243 发表于 2024-5-26 20:59:27

探索者里面有绘制型钢,用起来还挺方便的
页: [1]
查看完整版本: 求一个可以画冷弯C型钢的插件。