Object ID for area field

Discussion in 'AutoCAD' started by Clarence, Dec 17, 2004.

  1. Clarence

    Clarence Guest

    I am currently working on an autolisp command that will make an area field for a polyline. I have figured out everything except how to get and use the object id. I keep getting an error:

    bad argument type: stringp 2128026136

    That number is the object id, but I can't get the command to use it tho.

    Can someone help please?!?!?!

    here's the command:

    (defun c:ASF (/ ent)
    (command "undo" "g")
    (setq olderr *error*)
    (defun *error* (errmes)
    (princ
    (strcat "\n Area (Sq. Ft.) by Polyline halted by: \n"
    errmes
    )
    )
    (command "undo" "end")
    (setq *error* olderr)
    (command "undo" "1")
    (prin1)
    )
    (vl-load-com)
    (PROMPT "\n\nArea (S.F.) by Polyline....\n")
    (setq setosm (getvar "osmode"))
    (setvar "osmode" 16384)
    (setq ent (vlax-ename->vla-object (car (entsel "pick"))))
    (setq objidlwpoly (vla-get-objectid ent))
    (setq atfield
    (strcat
    "%<\\AcObjProp Object(%<\\_ObjId "
    objidlwpoly
    ">%).Area \\f \"%lu2%ct4%qf1 SQ. FT.\">%"
    )
    )
    (command "mtext" pause pause atfield "")
    (vlax-release-object ent)
    (setvar "osmode" setosm)
    (command "cmdecho" 1)
    (setq *error* olderr)
    (command "undo" "end")
    (princ userobjid)
    (princ)
    )
     
    Clarence, Dec 17, 2004
    #1
  2. Clarence

    BillZ Guest

    strcat expecta a string.

    (itoa objidlwpoly)


    Bill
     
    BillZ, Dec 17, 2004
    #2
  3. Clarence

    Jeff Mishler Guest

    ObjectID is an Integer........
     
    Jeff Mishler, Dec 17, 2004
    #3
  4. Clarence

    Clarence Guest

    I knew I was just overlooking something.....


    Thank you thank you thank you!!!!!

    BTW....its working GREAT!!!!!!
     
    Clarence, Dec 17, 2004
    #4
  5. Clarence

    BillZ Guest

    You're welcome,

    Glad I could help.

    Bill
     
    BillZ, Dec 17, 2004
    #5
  6. Clarence

    LUCAS Guest

    LUCAS, Dec 20, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.