Author Topic: Text Field  (Read 3106 times)

0 Members and 1 Guest are viewing this topic.

Fabricio28

  • Swamp Rat
  • Posts: 670
Text Field
« on: July 22, 2013, 01:53:06 PM »
Hi guys,
I'm using a great code from Lee Mac that select objects and insert area text as a field. (a2f.lsp)
But I'm trouble because I have 15 objects linking to field, and I need include more two objects. How Can I include these 2 objects and update the total area automatically?


Thank you

e.g
« Last Edit: July 22, 2013, 02:01:59 PM by FABRICIO28 »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Text Field
« Reply #1 on: July 22, 2013, 03:42:41 PM »
Could you not simply delete the field & re-run my Areas to Field program on all required objects?

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Field
« Reply #2 on: July 22, 2013, 04:16:37 PM »
Hi, Mr. Lee
Sure. I Can do that...

I was wondering if possible add other objects into the field.

It seems is not possible. :cry:

Thank you
Regards
« Last Edit: July 22, 2013, 04:55:47 PM by FABRICIO28 »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Text Field
« Reply #3 on: July 22, 2013, 05:46:32 PM »
Sure. I Can do that...

I was wondering if possible add other objects into the field.

It seems is not possible. :cry:

Yes of course it is possible - you can double-click on the field value to edit the formula field, right-click within the formula box and insert additional area property fields referencing the additional objects:



If you were looking for a program to do the work for you, I'm afraid that my voluntary time is limited and so you would need to cover the cost of my time spent creating the program.
« Last Edit: July 22, 2013, 05:55:15 PM by Lee Mac »

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Field
« Reply #4 on: July 23, 2013, 08:41:13 AM »
Hi Lee,
Thank you for explain how to insert additional area.

But I couldn't do it.  :ugly:
Would you explain this task in my dwg attach, please? :embarrassed:

Regards
 :-D

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Text Field
« Reply #5 on: July 23, 2013, 12:22:17 PM »
Double click the text where the area field is created so you can edit it. Then double click on the field inside the text editor. The field is usually shown as having a grey background. As tyhe 1st attachment.

This opens the Field dialog. Notice the Formula Field in the bottom right. Edit it to continue the formula, type a + and right-click to add another field into it (see 2nd attachment). This opens another field dialog. Set the field category to Objects, and Field names to Object. Then click the small button in top-middle (just below the Object type). Pick the new polyline you want to add to the area calc. This should return you to the field dialog, make sure you've got its Area selected and click OK (like 3rd attachment).

Thereafter just OK out of both dialogs and the field should now show the new total as per the 4th attachment.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Field
« Reply #6 on: July 23, 2013, 12:37:49 PM »
Whow
Many Thank irneb. Worked Perfect!

I really appreciate the help. I've learnt a really good stuff! :-D

Quote
If you were looking for a program to do the work for you, I'm afraid that my voluntary time is limited and so you would need to cover the cost of my time spent creating the program.
Sometimes we don't need a routine, the autocad has this function. :pissed:

Thank you Lee.

Kind Regards

kojacek

  • Mosquito
  • Posts: 14
Re: Text Field
« Reply #7 on: July 23, 2013, 05:12:11 PM »
Fabricio - try this code:
Code - Auto/Visual Lisp: [Select]
  1. ; =========================================================================================== ;
  2. ; =========================================================================================== ;
  3. (defun C:FUPD (/ sel obj ets fds ssp ssn suf prf)
  4.   (setq prf "%<\\AcObjProp Object(%<\\_ObjId "
  5.         suf ">%).Area \\f \"%lu6%qf1%ds44%th46\">%"
  6.   )
  7.   (if
  8.     (and
  9.       (setq sel (entsel "\nSelect a total summary field: "))
  10.       (member (cdr (assoc 0 (entget (car sel))))(list "TEXT" "MTEXT"))
  11.     )
  12.     (if
  13.       (setq fds (_getFieldObjs (vlax-ename->vla-object (car sel))))
  14.       (progn
  15.         (foreach % (setq ets (mapcar 'vlax-vla-object->ename fds))(redraw % 3))
  16.         (princ "\nSelect new polylines for add summary: ")
  17.         (if
  18.           (setq ssp
  19.             (ssget
  20.               (list (cons 0 "LWPOLYLINE,CIRCLE,REGION")
  21.                     (cons 410 (getvar "CTAB"))
  22.               )
  23.             )
  24.           )
  25.           (progn
  26.             (foreach % ets (redraw % 4))
  27.             (setq ssn
  28.               (mapcar
  29.                 (function
  30.                   (lambda (%)
  31.                     (strcat
  32.                       prf
  33.                       (vla-GetObjectIdString
  34.                         (vla-get-utility (cd:ACX_ADoc))
  35.                         % :vlax-false
  36.                       )
  37.                       suf
  38.                     )
  39.                   )
  40.                 )
  41.                 (append (cd:SSX_Convert ssp 1) fds)
  42.               )
  43.             )
  44.             (vla-put-textstring
  45.               (vlax-ename->vla-object (car sel))
  46.               (strcat
  47.                 "TOTAL: %<\\AcExpr "
  48.                 (cd:STR_ReParse ssn " + ")
  49.                 " \\f \"%lu6%qf1%ds44%th46\">%"
  50.               )
  51.             )
  52.           )
  53.           (progn
  54.             (foreach % ets (redraw % 4))
  55.             (princ "\nNot selected. ")
  56.           )
  57.         )
  58.       )
  59.       (princ "\nObject does not have associated fields.")
  60.     )
  61.     (princ "\nFailed selected. ")
  62.   )
  63.   (princ)
  64. )
  65. ; =========================================================================================== ;
  66. (defun _getFieldObjs (Obj)
  67.   (mapcar
  68.     (function (lambda (%)(vla-ObjectIdToObject (cd:ACX_ADoc)(read %))))
  69.     (mapcar
  70.       (function (lambda (%)(vl-list->string %)))
  71.       (mapcar
  72.         (function
  73.           (lambda (%)
  74.             (vl-remove-if (function (lambda (%)(or (< % 48)(> % 57)))) %)
  75.           )
  76.         )
  77.         (mapcar
  78.           (function (lambda (%)(vl-string->list %)))
  79.           (vl-remove-if-not
  80.             (function (lambda (%)(wcmatch % "<\\_ObjId*")))
  81.             (cd:STR_Parse (vla-fieldcode obj) "%" t)
  82.           )
  83.         )
  84.       )
  85.     )
  86.   )
  87. )
  88. ; =========================================================================================== ;
Functions: cd:ACX_ADoc, cd:STR_Parse, cd:STR_ReParse, cd:SSX_Convert are from:
 http://cad.pl/ftp/Pack/v1/CADPL-Pack-v1.html
First select the total field, and next select any polylines for add sum area.
Regards.
kojacek

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Field
« Reply #8 on: July 24, 2013, 08:13:55 AM »
First select the total field, and next select any polylines for add sum area.
Regards.
kojacek

Hi kojacek,
Thank you for the help, but your code didn't work.
message:
Code: [Select]
Select a total summary field: ; error: no function definition: CD:STR_PARSE

kojacek

  • Mosquito
  • Posts: 14
Re: Text Field
« Reply #9 on: July 26, 2013, 08:41:07 AM »
First select the total field, and next select any polylines for add sum area.
Regards.
kojacek

Hi kojacek,
Thank you for the help, but your code didn't work.
message:
Code: [Select]
Select a total summary field: ; error: no function definition: CD:STR_PARSE
Previouos copy file CADPL-Pack-v1.lsp from: http://cad.pl/ftp/Pack/v1/CADPL-Pack-v1.lsp or (http://cad.pl/ftp/Pack/v1/CADPL-Pack-v1.html), and load.
Regards
kojacek

Fabricio28

  • Swamp Rat
  • Posts: 670
Re: Text Field
« Reply #10 on: July 26, 2013, 11:16:49 AM »
Hi,
Thank you for replay kojacek

Actually I don't know how to invoke the code. :ugly:

Regards