Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi Everyone,
Is it possible to access fields with autolisp? I'd like to be able to link them with dimension text, but I want the user to be able to select the dimension they want, and then the field would update (using autolisp). I know very little about fields, and haven't been able to see how to change/update them using Lisp. (I'm using ACAD 2008, if that makes a difference.)
Angie
Solved! Go to Solution.
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Angie,
it's true that there are (at least i couldn't find) no VisualLisp functions to control Fields
but there are DXF group code for field and you can access it with (entget) if you like to dig.
but...as far as i understand fields are aimed to simple user who can not write a autolisp programs
if you know VisualLisp (especially Reactors) you could do 'almost' every thing that fields do.
what is the task you trying to achieve?
Moshe
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I want to have text linked with the dimensions. I know how to create the text from the dimensions using autolisp, but I'd like to have the text remain linked with the dimensions so that if the user makes a manual change to the drawing, the text showing the measurement would update without the user having to remember to run another program. Seems like using fields would be the answer.
Angie
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
"Seems like using fields would be the answer" so what is the obstacle?
Field, object, pick the text of dimension,measurement ?
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
How do I create a field linked to a dimension using autolisp? I can do it manually, but I'd like it to be part of the autolisp program so the user doesn't have to do it.
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
do the field you desire, then copy the strange text shown at the bottom ... this example is for area...
%<\AcObjProp Object(%<\_ObjId 8796079302672>%).Area \f "%pr0%lu2%ct4%qf1 SQ. FT.">%
use subst & entmod in lisp to apply the field to the text/attrib/mtext object.
HTH
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Not tested , but I think it is working if your OS is 32 .
(vl-load-com)
(defun c:Test (/ space ss pt)
; Tharwat 14. 06. 2011
(setq space (vla-get-modelspace
(vla-get-ActiveDocument (vlax-get-acad-object))
)
)
(if (and (setq ss (car (entsel "\n Select a Dimension : ")))
(setq pt (getpoint "\n Specify Text Location :"))
)
(vla-addMText
space
(vlax-3d-point pt)
4.
(strcat "%<\\AcObjProp Object(%<\\_ObjId "
(itoa (vla-get-ObjectID (vlax-ename->vla-object ss)))
">%).Measurement \\f \"%lu6\">%"
)
)
(princ)
)
(princ)
)
Tharwat
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Oh fantastic! that is just what I needed. Thank you so much!
Angie
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You're welcome .
Tharwat
Re: AutoLisp and Fields
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
I have been wanting to know how to use fields in lisp for a long time..
The routine submitted has shown me the way how to do it.
I have adapted the routine to generate the name of a block and also the layer name, something I have been doing long hand for a while now for block libraries Thanks for that.
Just one question, what does the expression 4. do?



