Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Contributor
putitonpaper
Posts: 19
Registered: ‎11-19-2006
Message 11 of 26 (701 Views)

Re: AutoLisp and Fields

11-17-2011 03:43 AM in reply to: angiegauthier

 

Can Lisp, or another method, be used to modify Fields in Sheetset etc. I'd like to modify or update dates, text, and revision fields within several large drawing packages which use Sheetsets, is this possible, what would be the best tool / method to use?

 

 

 

Thanks ! ! !

Contributor
Gustavo_Bernardi
Posts: 20
Registered: ‎05-30-2009
Message 12 of 26 (639 Views)

Re: AutoLisp and Fields

10-03-2012 07:32 AM in reply to: putitonpaper

why is not working?

 

(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)))
">%)Area \f "%lu2%pr2%ps[, m²]%ct8[0.0001]">%"
)
)
(princ)
)
(princ)
)

 

 

Thanks!

Active Member
kakt00z
Posts: 9
Registered: ‎10-08-2012
Message 13 of 26 (608 Views)

Re: AutoLisp and Fields

10-08-2012 12:24 AM in reply to: Gustavo_Bernardi

may be u need to add slash before quotes

something liske that :

"%<\AcObjProp Object(%<\_ObjId "

(itoa (vla-get-ObjectID (vlax-ename->vla-object ss)))

">%).Area \f \"%lu2\">%

*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 14 of 26 (596 Views)

Re: AutoLisp and Fields

10-08-2012 03:04 AM in reply to: Gustavo_Bernardi

Gustavo_Bernardi wrote:

why is not working?

 

Thanks!


(strcat
  "%<\\AcObjProp.16.2 Object(%<\\_ObjId "
  (itoa (vla-get-ObjectID (vlax-ename->vla-object ss)))
  ">%).Area \\f \"%lu2%pr2%ps[,m²]\">%"
  )

 

HTH

 

Contributor
Gustavo_Bernardi
Posts: 20
Registered: ‎05-30-2009
Message 15 of 26 (560 Views)

Re: AutoLisp and Fields

10-09-2012 03:35 PM in reply to: putitonpaper

nothing yet ...

I need to measure the area that is in centimeters and put text in square meters. It would be great if you could put the unit at the end of the text (m2).

Thanks for now

*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 16 of 26 (556 Views)

Re: AutoLisp and Fields

10-09-2012 05:59 PM in reply to: Gustavo_Bernardi

Gustavo_Bernardi wrote:

nothing yet ...

I need to measure the area that is in centimeters and put text in square meters. It would be great if you could put the unit at the end of the text (m2).

Thanks for now


Nothing happens? no prompt for text location or no text at all? whats the error?

sq centimeters to sq meters -- > 15000 = 1.5 ?

64 bit OS?

 

It would help if you'll give us more info.

 

Contributor
Gustavo_Bernardi
Posts: 20
Registered: ‎05-30-2009
Message 17 of 26 (534 Views)

Re: AutoLisp and Fields

10-12-2012 09:24 PM in reply to: putitonpaper

Hi, yes my OS is 64-bit.

The object selection is no problem, the base point is then asked me the error that appears is this:
"Specify Text Location:, error: bad argument type: nil stringp"

What I did was take the code at the beginning of this topic. So I changed that part of the field by code provided by window creation field with my desired properties.

Yes, what I need is a measure of area with the value 15000 return me the value 1.5

 

Thanks for your patience

 

The code works for you?

 

(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)))
">%)Area \f "%lu2%pr2%ps[, m²]%ct8[0.0001]">%"
)
)
(princ)
)
(princ)
)

 

*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 18 of 26 (529 Views)

Re: AutoLisp and Fields

10-12-2012 10:09 PM in reply to: Gustavo_Bernardi

Try the attached file

 

Contributor
Gustavo_Bernardi
Posts: 20
Registered: ‎05-30-2009
Message 19 of 26 (497 Views)

Re: AutoLisp and Fields

10-17-2012 06:18 AM in reply to: pbejse

The field works well ... thank you

 

Just wish I could control the width of the text box so that the symbol is not in the second row.

In another lisp that I created, I used the code STRLEN to get the text length (in letters) and multiply by an average width.

 

I still have to study these VL-something ... I do not understand any of this, I create my lisps only with get--- and command

 

Thank you for your attention

*Expert Elite*
pbejse
Posts: 2,500
Registered: ‎11-24-2009
Message 20 of 26 (487 Views)

Re: AutoLisp and Fields

10-17-2012 08:44 AM in reply to: Gustavo_Bernardi

Gustavo_Bernardi wrote:

The field works well ... thank you

 

Just wish I could control the width of the text box so that the symbol is not in the second row.

In another lisp that I created, I used the code STRLEN to get the text length (in letters) and multiply by an average width.

  

Thank you for your attention


You are welcome, I will look into that width thingy tommorrow.

 

Cheers

Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.