Author Topic: Field suffix in Table  (Read 2255 times)

0 Members and 1 Guest are viewing this topic.

REGHUYES

  • Newt
  • Posts: 21
Field suffix in Table
« on: January 09, 2014, 08:32:23 AM »
This is Lee Mac's code .Is it possible to add "Sq m" suffix for field.Iam begineer to Auto lisp
Code - Auto/Visual Lisp: [Select]
  1. (defun c:sCell (/ tab ent Obj pt tObj row col)
  2.   (if (and (setq tab (car (entsel "\nSelect Table: ")))
  3.            (eq "ACAD_TABLE" (cdr (assoc 0 (entget tab)))))
  4.     (while
  5.       (and
  6.         (setq ent (car (entsel "\nSelect Room: ")))
  7.           (setq Obj
  8.             (vlax-ename->vla-object ent)) 'Area))
  9.       (while
  10.         (progn
  11.           (setq pt (getpoint "\nClick into Cell to place field: "))
  12.           (cond ((vl-consp pt)
  13.                  (if (eq :vlax-true
  14.                        (vla-hittest
  15.                          (setq tObj
  16.                            (vlax-ename->vla-object tab))
  17.                              (vlax-3D-point pt)
  18.                                (vlax-3D-point (trans '(0 0 1) 0 1)) 'row 'col)) nil
  19.                    (princ "\n** No Cell Selected **")))
  20.                 (t (princ "\n** No Point Selected **")))))
  21.       (vla-setText tObj row col
  22.         (strcat
  23.           "%<\\AcObjProp Object(%<\\_ObjId "
  24.             (vl-princ-to-string
  25.               (vla-get-Objectid Obj))
  26.                 ">%).Area \\f \"%lu2%pr2\">%")))
  27.     (princ "\n** No Table Selected **"))
  28.   (princ))
  29.  
« Last Edit: January 09, 2014, 08:36:39 AM by REGHUYES »

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Field suffix in Table
« Reply #1 on: January 09, 2014, 11:08:35 AM »
Not tested but maybe change this:
">%).Area \\f \"%lu2%pr2\">%"
to
">%).Area \\f \"%lu2%pr2%ps[,SQ m]\">%"

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

REGHUYES

  • Newt
  • Posts: 21
Re: Field suffix in Table
« Reply #2 on: January 09, 2014, 10:47:25 PM »
Thank u "ronjonp" sir.
How to select two or more rooms.
reference image attached
« Last Edit: January 15, 2014, 11:37:59 PM by REGHUYES »