VAC Posted April 30, 2019 Posted April 30, 2019 Hi, thank you, but there must be some mistake, because the script is not executed. It is may be in brackets or anythink else worse in it, but I don't undestand its syntax. Please look at it once more. I replaced (vlax-3D-point (trans '(0 0 1) 0 1)) 'row 'col)) nil with (vlax-3D-point (trans (getvar 'viewdir) 1 0 T)) 'row 'col)) nil Quote
Roy_043 Posted May 1, 2019 Posted May 1, 2019 I overlooked the fact that the picked cell point has to be translated to the WCS: (defun c:sCell (/ tab ent Obj pt tObj row col) (vl-load-com) (if (and (setq tab (car (entsel "\nSelect Table: "))) (eq "ACAD_TABLE" (cdr (assoc 0 (entget tab))))) (while (and (setq ent (car (entsel "\nSelect Room: "))) (vlax-property-available-p (setq Obj (vlax-ename->vla-object ent)) 'Area)) (while (progn (setq pt (getpoint "\nClick into Cell to place field: ")) (cond ((vl-consp pt) (if (eq :vlax-true (vla-hittest (setq tObj (vlax-ename->vla-object tab)) (vlax-3d-point (trans pt 1 0)) (vlax-3d-point (trans (getvar 'viewdir) 1 0 T)) 'row 'col)) nil (princ "\n** No Cell Selected **"))) (t (princ "\n** No Point Selected **"))))) (vla-setText tObj row col (strcat "%<\\AcObjProp Object(%<\\_ObjId " (LM:objectid (vlax-ename->vla-object ent)) ">%).Area \\f \"%lu2%pr2%ds44%ct8[1e-006]\">%"))) (princ "\n** No Table Selected **")) (princ)) Quote
VAC Posted August 17, 2019 Posted August 17, 2019 Hi, script works fine for me. I have one more question. I need to multiply the obtained area value by X, (for ex. 2times). First, it shoud by set at the beginning of the script like (setg multiplier 2) and how, to implement it to the script, I think it shoud be in this line? (strcat "%<\\AcObjProp Object(%<\\_ObjId " (LM:objectid (vlax-ename->vla-object ent)) ">%).Area \\f \"%lu2%pr2%ds44%ct8[1e-006]\">%")) or better second way, script will ask me with the dialog at the begining of the script for variable "multiplier" Thank you Quote
VAC Posted August 18, 2019 Posted August 18, 2019 Hi, script works fine for me. I have one more question. I need to multiply the obtained area value by X, (for ex. 2times). First, it shoud by set at the beginning of the script like " (setg multiplier 2) how, to implement it I think to this line? (strcat "%<\\AcObjProp Object(%<\\_ObjId " (LM:objectid (vlax-ename->vla-object ent)) ">%).Area \\f \"%lu2%pr2%ds44%ct8[1e-006]\">%")) or better second way, script will ask me with the dialog at the begining of the script for variable "multiplier" Thank you ------------------------- I find out answer to my both questions: (setq multiplier (getdist "\nSet multiplier") and "%<\\AcExpr (%<\\AcObjProp Object(%<\\_ObjId " (LM:objectid (vlax-ename->vla-object ent)) ">%).Area>%*multiplier) \\f \"%lu2%pr2%ds44%ct8[1e-006]\">%"))) Quote
YaUs Posted August 30, 2020 Posted August 30, 2020 Hi, LeeMac On 7/9/2009 at 8:50 PM, Lee Mac said: This will put your fields into cells in a table. Select your table. Select your rooms in turn. Click inside the cell you want the field in. (defun c:sCell (/ tab ent Obj pt tObj row col) (vl-load-com) (if (and (setq tab (car (entsel "\nSelect Table: "))) (eq "ACAD_TABLE" (cdr (assoc 0 (entget tab))))) (while (and (setq ent (car (entsel "\nSelect Room: "))) (vlax-property-available-p (setq Obj (vlax-ename->vla-object ent)) 'Area)) (while (progn (setq pt (getpoint "\nClick into Cell to place field: ")) (cond ((vl-consp pt) (if (eq :vlax-true (vla-hittest (setq tObj (vlax-ename->vla-object tab)) (vlax-3D-point pt) (vlax-3D-point (trans '(0 0 1) 0 1)) 'row 'col)) nil (princ "\n** No Cell Selected **"))) (t (princ "\n** No Point Selected **"))))) (vla-setText tObj row col (strcat "%<\\AcObjProp Object(%<\\_ObjId " (vl-princ-to-string (vla-get-Objectid Obj)) ">%).Area \\f \"%lu2%pr2\">%"))) (princ "\n** No Table Selected **")) (princ)) Thank you for your solution. For some reason, when I try to implement it using polylines, the field in cell shows ####. Any ideas on how to fix it? Thank you! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.