• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    Contributor
    Posts: 17
    Registered: ‎11-19-2006

    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 ! ! !

    Please use plain text.
    Contributor
    Posts: 20
    Registered: ‎05-30-2009

    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!

    Please use plain text.
    Member
    Posts: 3
    Registered: ‎10-08-2012

    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\">%

    Please use plain text.
    *Expert Elite*
    Posts: 2,136
    Registered: ‎11-24-2009

    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

     

    Please use plain text.
    Contributor
    Posts: 20
    Registered: ‎05-30-2009

    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

    Please use plain text.
    *Expert Elite*
    Posts: 2,136
    Registered: ‎11-24-2009

    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.

     

    Please use plain text.
    Contributor
    Posts: 20
    Registered: ‎05-30-2009

    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)
    )

     

    Please use plain text.
    *Expert Elite*
    Posts: 2,136
    Registered: ‎11-24-2009

    Re: AutoLisp and Fields

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

    Try the attached file

     

    Please use plain text.
    Contributor
    Posts: 20
    Registered: ‎05-30-2009

    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

    Please use plain text.
    *Expert Elite*
    Posts: 2,136
    Registered: ‎11-24-2009

    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

    Please use plain text.