Code Red > AutoLISP (Vanilla / Visual)

A program to draw lines

(1/4) > >>

rugaroo:
Take a look at the following pdf file from my local book of design standards.

Sight Visibility Zones - 201.2

How hard do you guys think it would be to write a  lisp to automatically draw the sight zones?

I tried to start write something before, but never got to be too successful with that. Here is what I had:


--- Code: ---(DEFUN c:svz ()
  (SETQ cmd (GETVAR "cmdecho"))
  (SETVAR "cmdecho" 0)
  (SETQ arc (ENTSEL "\nSelect intersection arc: "))
  (SETQ starc  (GETPOINT (VLAX-3D-POINT (VLAX-CURVE-GETSTARTPOINT arc)))
endarc (GETPOINT (VLAX-3D-POINT (VLAX-CURVE-GETENDPOINT arc)))
  )
  (VL-CMDF "line" starc endarc "")
  (setq chord (vlax-ename->vla-object (entlast)))
  (setq minrow (entsel "\nSelect minor right of way line: ")
minlin (vlax-ename->vla-object minrow)
)
  (setq majrow (entsel "\nSelect major right of way line: ")
majlin (vlax-ename->vla-object majrow)
)
  (PRINC)
)
--- End code ---


At least this will give you an idea of where I was possibly headed.

Rug

SMadsen:
Doesn't look hard. Seems like a question of a few parameters and then looking up values in a table.

By the way, what's a row?

I don't know if your code is on the right track yet, but at least it could use an overhaul:

--- Code: ---(defun c:svz ()
  (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))
                )
               )
         )
        )
  )
  (setvar "cmdecho" cmd)
  (princ)
)
--- End code ---

daron:
Not to do it for you, I'll give you some functions to think about that should help.
- intersectWith method in ActiveX and VBA Reference
That will give you the imaginary intersection of two selected objects.
- polar funtion.
That will help you move a point along two points in any direction. Lines are fairly simple, but arcs might require some more math. Take a look at that one function I gave you that caused the offsets to be reversed. I believe I have some work for arcs in there.

rugaroo:
Madsen / Daron -

Thanks. What I had posted was rough.

Row - Right of way...pretty much a dedication of land for the development of roadways. Mark may have a more detailed explaination, but that is the just of it.

I totally forgot about the intersect with. That will make things a lot easier. However, I don't know much about that or the polar function...I will go do some reading and see if I can get something together

rugaroo:
How would I fix this to where it sets my variables correctly:


--- Code: ---(defun getvars ()
  (setq minwdt (getreal "\nWhat is the minor R/W width: ")
majwdt (getreal "\nWhat is the major R/W width: ")
)
  (if
    (and
      ((= minwdt 48) (= majwdt 48))
    (setq a 53
 b 6
 c 6
 d 42
 )
      )
    )
  (if
    (and
      ((= minwdt 48) (= majwdt 51))
      (setq a 39
   b 5
   c 5
   d 31
   )
      )
    )
  (if
    (and
      ((= minwdt 48) (= majwdt 60))
      (setq a 66
   b 5
   c 5
   d 55
   )
      )
    )
  (if
    (and
      ((= minwdt 48) (= majwdt 80))
      (setq a 100
   b 6
   c 5
   d 36
   )
      )
    )
  (if
    (and
      ((= minwdt 48) (= majwdt 100))
      (setq a 184
   b 6
   c 5
   d 53
   )
      )
    )
  (if
    (and
      ((= minwdt 51) (= majwdt 48))
      (setq a 51
   b 6
   c 6
   d 40
   )
      )
    )
  (if
    (and
      ((= minwdt 51) (= majwdt 51))
      (setq a 37
   b 4
   c 4
   d 29
   )
      )
    )
  (if
    (and
      ((= minwdt 51) (= majwdt 60))
      (setq a 64
   b 5
   c 5
   d 53
   )
      )
    )
  (if
    (and
      ((= minwdt 51) (= majwdt 80))
      (setq a 98
   b 6
   c 5
   d 34
   )
      )
    )
  (if
    (and
      ((= minwdt 51) (= majwdt 100))
      (setq a 182
   b 6
   c 5
   d 51
   )
      )
    )
  (if
    (and
      ((= minwdt 60) (= majwdt 48))
      (setq a 46
   b 6
   c 6
   d 50
   )
      )
    )
  (if
    (and
      ((= minwdt 60) (= majwdt 51))
      (setq a 33
   b 4
   c 4
   d 37
   )
      )
    )
  (if
    (and
      ((= minwdt 60) (= majwdt 60))
      (setq a 56
   b 5
   c 5
   d 48
   )
      )
    )
  (if
    (and
      ((= minwdt 60) (= majwdt 80))
      (setq a 90
   b 5
   c 4
   d 30
   )
      )
    )
  (if
    (and
      ((= minwdt 60) (= majwdt 100))
      (setq a 174
   b 6
   c 5
   d 47
   )
      )
    )
  (if
    (and
      ((= minwdt 80) (= majwdt 60))
      (setq a 56
   b 6
   c 6
   d 58
   )
      )
    )
  (if
    (and
      ((= minwdt 80) (= majwdt 80))
      (setq a 73
   b 6
   c 6
   d 35
   )
      )
    )
  (if
    (and
      ((= minwdt 80) (= majwdt 100))
      (setq a 157
   b 6
   c 6
   d 58
   )
      )
    )
  (if
    (and
      ((= minwdt 100) (= majwdt 80))
      (setq a 56
   b 4
   )
      )
    )
  (if
    (and
      ((= minwdt 100) (= majwdt 100))
      (setq a 140
   b 5
   )
      )
    )
  )
--- End code ---


Rug

Navigation

[0] Message Index

[#] Next page

Go to full version