Author Topic: AECC_Points  (Read 5865 times)

0 Members and 1 Guest are viewing this topic.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« on: November 19, 2003, 05:02:35 PM »
I need to build a sset of aecpoints and have each point turned into a blk. Here is the old program that I have, but it only takes old R14 point blks.

Code: [Select]
;*************************************************************************
;********************  ELEVATION GRADE TAG UTILITIES  ********************
;                   ******  Edit Date: 04/26/96  ******
;                        *************************
;                        *************************
(defun rtd (r)
  (* 180.0 (/ r pi))
)
;
;
(defun C:TI (/ scl cmd elev desc blk pnt ra1)
  (setvar "cmdecho" 0)
  (setq scl (getvar "ltscale")
        cmd (getvar "cmdecho")
        elev (getstring "\n***Grade Tag Elevation:   ")
        desc (getstring "\n***Grade Tag Descriptor:  ")
  )
  (prompt "\n***Insertion Point & Rotation:")
  (command "insert" "/acad/blocks/gtc" pause scl "" pause elev desc)
  (setq blk (entget (entlast))
        pnt (cdr (assoc 10 blk))
        ra1 (cdr (assoc 50 blk))
  )
  (if (> (* pi 1.5) ra1 (* pi 0.5))
    (progn
      (command "erase" pnt "")
      (setq ra1 (+ 180.0 (/ (* ra1 180.0) pi)))
      (command "insert" "/acad/blocks/gtcl" pnt scl "" ra1 elev desc)
    )
  )
  (prin1)
)

;****************************************************************************

(defun C:TF (/ scl itm lst typ ins rot at1 elv at2 dsc)
  (setq scl (getvar "ltscale")
        itm (car (entsel "\nSelect Tag:"))
        lst (entget itm)
        typ (cdr (assoc 2 lst))
  )
  (if (or (= "GTCL" typ) (= "GTC" typ))
      (progn
        (setq ins (cdr (assoc 10 lst))
              rot (+ 180 (rtd (cdr (assoc 50 lst))))
              at1 (entget (entnext itm))
              elv (cdr (assoc 1 at1))
              at2 (entget (entnext (entnext itm)))
              dsc (cdr (assoc 1 at2))
        )
        (command "erase" itm "")
        (if (= "GTCL" typ)
            (command "insert" "gtc" ins scl "" rot elv dsc)
        )
        (if (= "GTC" typ)
            (command "insert" "gtcl" ins scl "" rot elv dsc)
        )
      )
      (prompt "\n*** Please Select only Grade Tags ***")
  )
  (prin1)
)

;****************************************************************************

(defun C:T2P (/ scl bas num tag tst el1 el2 dsc ins)
  (setq scl (getvar "ltscale"))
  (initget 1)
  (setq bas (getint "\n** Enter Base Elevation:  "))
  (initget 1)
  (setq num (getint "\n** Enter Beginning Point Number:   ")
        tag T
  )
  (while (/= nil tag)
    (setq tag (car (entsel "\n* Select Tag for Conversion:")))
      (if (/= nil tag) (setq tst (cdr (assoc 2 (entget tag)))))
      (if (not (or (= "GTC" tst) (= "GTCL" tst) (= nil tst)))
          (prompt "\n*****Selected Entity Must be GTC or GTCL Tag Block*****")
      )
      (if (or (= "GTC" tst) (= "GTCL" tst))
          (progn
            (setq el1 (cdr (assoc 1 (entget (entnext tag))))
                  el2 (rtos (+ bas (atof el1)) 2 2)
                  dsc (cdr (assoc 1 (entget (entnext (entnext tag)))))
                  ins (cdr (assoc 10 (entget tag)))
                  tst nil
            )
            (command "insert" "point" ins scl "" "" el2 num dsc)
            (setq num (1+ num))
          )
      )
  )
  (prin1)
)

;****************************************************************************

(defun C:P2T (/ scl pnt tst ins elv dsc ln1 dif rt1 rt2)
  (setq scl (getvar "ltscale")
        pnt (car (entsel "\n**Select Point"))
        tst (cdr (assoc 2 (entget pnt)))
  )
  (if (/= "point" tst)
      (prompt "\n*****Selected Entity Must be Acad Point*****")
      (progn
        (setq ins (cdr (assoc 10 (entget pnt)))
              elv (cdr (assoc 1 (entget (entnext pnt))))
              dsc (cdr (assoc 1 (entget (entnext (entnext (entnext pnt))))))
              ln1 (strlen elv)
        )
        (if (> ln1 5)
            (progn
              (setq dif (- ln1 4)
                    elv (substr elv dif)
                    elv (strcat ""elv"")
              )
            )
            (setq elv (strcat ""elv""))
        )
        (command "insert" "/acad/blocks/gtc" ins scl "" pause elv dsc)
        (setq rt1 (cdr (assoc 50 (entget (entlast)))))
        (if (> (* 1.5 pi) rt1 (* 0.5 pi))
            (progn
              (command "erase" (entlast) "")
              (setq rt2 (rtd (+ rt1 pi)))
              (command "insert" "/acad/blocks/gtcl" ins scl "" rt2 elv dsc)
            )
        )
      )
  )
  (prin1)
)

;****************************************************************************
;****************************************************************************



Can you guys please help?

Rug
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #1 on: November 19, 2003, 05:16:33 PM »
OK, I'm curious Rug, why? AECC points are better than blocks.
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #2 on: November 19, 2003, 05:27:10 PM »
Stupid 'Company Standards'
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

daron

  • Guest
AECC_Points
« Reply #3 on: November 19, 2003, 05:29:41 PM »
Revolt! Sometimes companies need to be shown where the light is. Truely, standards shouldn't be static, they should be flexible and open to discussion and new ideas, unless you work for the gov't, like Mark.

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #4 on: November 19, 2003, 05:41:28 PM »
Believe me, I have tried, but they will nor allow it until it is required by our entities.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #5 on: November 19, 2003, 06:12:03 PM »
Ok, so what info do you want to retrieve from the AECC points?
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #6 on: November 19, 2003, 06:17:08 PM »
The only info is the descriptor, and the elevation. If the point reads 1999.82, all I am going to need is the 99.82 portion.

After that the block gtc or gtcl will be inserted at the point with the descriptor, and elevation.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #7 on: November 19, 2003, 06:19:45 PM »
> If the point reads 1999.82, all I am going to need is the 99.82 portion.

Some how I knew you were going to say that!

Tell ya what, if I give you code that extracts the data from the AECC point can you insert that into the block?
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #8 on: November 19, 2003, 06:21:19 PM »
Well, if you give me something that can extract the point data, and leave the original elevation, then I will be able to use the lower.lsp prog you gave me a while back.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #9 on: November 19, 2003, 06:21:45 PM »
BTW, are you going to select the points or do a block for ALL of the points.
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #10 on: November 19, 2003, 06:23:35 PM »
I know selecting each block individually would be a pain to figure out, so might as well do it with all points selected at once, and then have a single blk inserted for all of them, and then if I need to change the blks rotation, I can mirrtext and then mirror the blk.
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #11 on: November 19, 2003, 06:26:46 PM »
So we're going to do a
(setq ss (ssget '((0 . "AECC_POINT"))))
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #12 on: November 19, 2003, 06:29:33 PM »
Correct....
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #13 on: November 19, 2003, 06:33:41 PM »
okay here we go......... be back soon.
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #14 on: November 19, 2003, 08:04:52 PM »
Code: [Select]
;;; example (setq p-data (pt_data))
    ;;; all data based on AECC points in the dwg NOT the database
    (defun pt_data (/ PointData ss output)
      (gc)
      (defun PointData (ss / ent)
        (cond
          ((setq ent (ssname ss 0))
           (setq output ; <-- global variable
                  (cons
                    (list
                      (cdr (assoc 90 (entget ent)))           ; point number
                      (cdr (assoc 10 (entget ent)))           ; insertion point
                      (car (reverse (assoc 11 (entget ent)))) ; elev
                      (cdr (assoc 303 (entget ent)))          ; description
                      )
                    output
                    ) ; cons
                 ) ; setq
           (PointData (ssdel ent ss))
           )
          (T nil)
          ) ; cond
        ) ; defun PointData
      ;; (1 (480.127 760.395 0.0) 12.0 "top of bank") *sample*

      (if (setq ss (ssget '((0 . "AECC_POINT"))))
        (PointData ss)
        ) ; if
      output
      ) ; defun
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #15 on: November 20, 2003, 03:35:58 PM »
Mark-

i was unable to get yours to work with insertion of blks. this is what i got, but no go...any ideas'????



Code: [Select]
(DEFUN c:ptt ()
  (SETQ lts   (GETVAR "LTSCALE")
ent   (ENTGET "\nSelect ACAD point block: ")
inspt (CDR (ASSOC 10 (ENTGET ent)))
eleva (CAR (REVERSE (ASSOC 11 (ENTGET ent))))
descr (CAR (REVERSE (ASSOC 11 (ENTGET ent))))
  )
  (COMMAND "INSERT" "GTC"     inspt
  lts ""       ""     eleva
  descr
 )
  (PRINC)
)
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #16 on: November 20, 2003, 05:06:40 PM »
Rug, what I gave you returns a list containing all the necessary point data you need to insert your blocks.
*sample* (1 (480.127 760.395 0.0) 12.0 "top of bank")

1=point number
(480.127 760.395 0.0) = insertion point of block
12.o = elevation
"top of bank" = description
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #17 on: November 20, 2003, 05:22:30 PM »
Like this Rug.
Code: [Select]

;; it breaks down like this
 ; return list of data from user selection
 (setq p-data (pt_data))

 ; list of point data
 (setq pt1 (car p-data))
  return = (24 (1119.64 1066.54 0.0) 12.0 "tmp")

 ; insetion point of block
 (setq insert-pt (cadr pt1))
  return = (1119.64 1066.54 0.0)

 ; elevation
 (caddr pt1)
  return = 12.0

 ; description
  (last pt1)
  return = "tmp"


So your program will look like this
Code: [Select]

(defun c:ptt (/ lts p-data)
      (prompt "\nSelect AECC Points")
      (setq p-data (pt_data))
      (setq lts (getvar 'ltscale))
      (if p-data
        (foreach item p-data
          (command "_insert" "GTC" (cadr item) lts "" "" (caddr item) (last item))
          )
        )
      )
TheSwamp.org  (serving the CAD community since 2003)

Mark

  • Custom Title
  • Seagull
  • Posts: 28683
AECC_Points
« Reply #18 on: November 20, 2003, 06:07:14 PM »
Here, try this one.
Code: [Select]

;;; example (setq p-data (pt_data))
;;; all data based on AECC points in the dwg NOT the database
(defun pt_data (/ PointData ss output)

  (defun PointData (ss / ent)
    (cond
      ((setq ent (ssname ss 0))
       (setq output ; <-- global variable to this function
             (cons
               (list
                 (cdr (assoc 90 (entget ent)))           ; point number
                 (cdr (assoc 10 (entget ent)))           ; insertion point
                 (car (reverse (assoc 11 (entget ent)))) ; elev
                 (cdr (assoc 303 (entget ent)))          ; description
                 )
               output
               ) ; cons
             ) ; setq
       (PointData (ssdel ent ss))
       )
      (T nil)
      ) ; cond
    ) ; defun PointData
  ;; (1 (480.127 760.395 0.0) 12.0 "top of bank") *sample*

  (if (setq ss (ssget '((0 . "AECC_POINT"))))
    (PointData ss)
    ) ; if
  output
  ) ; defun

;;
;;   main function
;;

(defun c:ptt (/ lts p-data)
 
  (prompt "\nSelect AECC Points")
  (setq p-data (pt_data));; call pt_data
 
  ;; block scale
  (setq lts (getvar 'ltscale))
 
  (if p-data
    (foreach
      item
      p-data
      (setq el (rtos (caddr item) 2 2)); round off the elev.
      (command "_insert" "GTC" (cadr item) lts "" "" el (last item))
      )
    )
  (princ (strcat "\n"(itoa (length p-data))" Blocks Inserted"))
  (princ)
  )
TheSwamp.org  (serving the CAD community since 2003)

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #19 on: November 21, 2003, 03:41:57 PM »
Mark - sorry it took me a bit to get back, but it works great....now I was geting a little froggish again, and was thinking of adding a datum removal. here is what I did...any comments/ideas?

Code: [Select]
;; datum removal

(defun datrem ()
  (setq datum0 (el)
datum1 (/ el 1000)
datum2 (rtos (datum1) 2 0)
datum3 (* datum2 1000)
datum (datum3)
el (- datum0 datum3)
)
  )


;;
;;   main function
;;

(defun c:ptt (/ lts p-data)
  (setq cmd (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (prompt "\nSelect AECC Points")
  (setq p-data (pt_data));; call pt_data
   
  ;; block scale
  (setq lts (getvar 'ltscale))
 
  (if p-data
    (foreach
      item
      p-data
      (setq el (rtos (caddr item) 2 2)); round off the elev.
      (datrem)
      (command "_insert" "GTC" (cadr item) lts "" "" datum (last item))
      )
    )
  (setvar "cmdecho" cmd)
  (princ (strcat "\n"(itoa (length p-data))" Blocks Inserted"))
  (princ)
  )


Rug
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017

rugaroo

  • Bull Frog
  • Posts: 378
  • The Other CAD Guy
AECC_Points
« Reply #20 on: November 21, 2003, 04:15:37 PM »
I have also noticed that when I try to use this on another persons machine the dialog for the attrib edit dialog comes up. I tried setting cmdecho and initdia, but still no go...any idea?
LDD06-09 | C3D 04-19 | Infraworks 360 | VS2012-VS2017