Author Topic: AECC_Points  (Read 11904 times)

0 Members and 1 Guest are viewing this topic.

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: 28753
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: 28753
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: 28753
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