Author Topic: A program to draw lines  (Read 19813 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
A program to draw lines
« Reply #15 on: October 02, 2003, 03:00:39 PM »
Show us what you've tried.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
A program to draw lines
« Reply #16 on: October 03, 2003, 02:30:28 PM »
Here is what I have done up to now.

Code: [Select]
(defun GETVARS (MINWDT MAJWDT / TABLE)
  (setq TABLE '((48
(48 53 6 6 42)
(51 39 5 5 31)
(60 66 5 5 55)
(80 100 6 5 36)
(100 184 6 5 53)
)
(51
(48 51 6 6 40)
(51 37 4 4 29)
(60 64 5 5 53)
(80 98 6 5 34)
(100 182 6 5 34)
)
(60
(48 46 6 6 50)
(51 33 4 4 37)
(60 56 5 5 48)
(80 90 5 4 30)
(100 174 6 5 47)
)
(80 (60 56 6 6 58) (80 73 6 6 58) (100 157 6 6 58))
(100 (80 56 4 0 0) (100 140 5 0 0))
      )
  )
  (cdr (assoc MAJWDT (cdr (assoc MINWDT TABLE))))
)


(defun CIRCLEMAKE (INT RAD /)
  (entmake (list
    (cons 0 "CIRCLE")
    (cons 100 "ACDBENTITY")
    (cons 100 "ACDBCIRCLE")
    (cons 10 INT)
    (cons 40 RAD)
  )
  )
)


(defun C:SVZ (/ MATCH MINWDT MAJWDT A B C D)
  (setq MINWDT (getdist "Specify minor R/W width: ")
MAJWDT (getdist "\nSpecify major R/W width: ")
  )
  (cond ((and MINWDT MAJWDT)
(setq MATCH (GETVARS MINWDT MAJWDT))
(setq A (nth 0 MATCH)
      B (nth 1 MATCH)
      C (nth 2 MATCH)
      D (nth 3 MATCH)
)
)
  )

  (setq CMD (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (cond
    ((setq ARC (entsel "\nSelect intersection arc: "))
     (setq ARC  (vlax-ename->vla-object (car ARC))
  STARC  (vlax-curve-getstartpoint ARC)
  ENDARC (vlax-curve-getendpoint ARC)
     )
     (vl-cmdf "line" STARC ENDARC "")
     (setq CHORD (vlax-ename->vla-object (entlast)))
     (cond
       ((and (setq MINROW (entsel "\nSelect minor right of way line: "))
    (setq MAJROW (entsel "\nSelect major right of way line: "))
)
(setq MINLIN (vlax-ename->vla-object (car MINROW))
     MAJLIN (vlax-ename->vla-object (car MAJROW))
)
       )
     )
     (GETVARS)
     (vl-cmdf "offset" MAJLIN B "")
     (setq MAJTMP (vlax-ename->vla-object (car (entlast))))
     (CIRCLEMAKE (vla-intersectwith MINROW MAJROW) A)
     (setq ACIR (vlax-ename->vla-object (car (entlast))))
     (vl-cmdf "line"
     (vla-intersectwith (ACIR MAJROW))
     (vla-intersectwith (MAJTMP CHORD))
     ""
     "erase"
     ACIR
     MAJTMP
     ""
     )
    )
  )
  (setvar "cmdecho" CMD)
  (princ)
)
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

daron

  • Guest
A program to draw lines
« Reply #17 on: October 03, 2003, 02:54:12 PM »
Quote
Code: [Select]
(setq ARC     (vlax-ename->vla-object (car ARC))
      STARC  (vlax-curve-getstartpoint ARC)
      ENDARC (vlax-curve-getendpoint ARC)
     )
     (vl-cmdf "line" STARC ENDARC "")

I haven't tried or spent much time on this yet, but at first glance it seems we need to ween you of the vl-cmdf crutch. You've got a start point and an endpoint. You need to put this (setq model (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object)))) in the code and then
(vla-addLine model starc endarc) in place of vl-cmdf. If you're going to go through the vla-object, you may as well finish by creating one.[/quote][/code]