entmode trouble

Discussion in 'AutoCAD' started by Adesu, Sep 10, 2004.

  1. Adesu

    Adesu Guest

    Hi Alls,I just got trouble to edit scale of line,what wrong in my
    code,thanks a lot for your reply

    Command: esl
    SELECT LINE:
    ENTER NUMBER FOR NEW SCALE LINE: 100
    ; error: bad DXF group: ((-1 . <Entity name: 14aedb8>) (0 . "LINE") (330 .
    <Entity name: 14aecf8>) (5 . "4F") (100 . "AcDbEntity") (67 . 0) (410 .
    "Model") (8 . "Layer1") (6 . "DASHED") (48 . 100.0) (100 . "AcDbLine") (10
    3.5414 9.13174 0.0) (11 15.5016 9.13174 0.0) (210 0.0 0.0 1.0))


    ; esl is stand for edit scale line
    ; Design by Ade Suharna
    ; 23 August 2004
    ; Edit by Ade Suharna 10/09/2004
    ; Attention
    ; procedure in order program can be run
    ; 1).load linetype more one type
    ; 2).set a linetype with scale "X" value
    ;
    (defun c:esl (/ ent1 ent2 ent3 opt opt1 opt2 ed)
    (setq ent1 (entget (car (entsel "\nSELECT LINE: "))))
    (setq ent2 (assoc 48 ent1))
    (setq ent3 nil)
    (setq ent2 (cond ((= ent2 ent3)(alert (strcat "\nATTENTION"
    "\n1).You must load linetype"
    "\n2).Set a linetype by x value"
    "\n2). Run this program"))(exit))
    ((= ent2 ent2)(setq ent2 ent2))
    )
    )
    (setq opt (getreal "\nENTER NUMBER FOR NEW SCALE LINE: "))
    (setq opt1 (subst (cons 48 opt)(assoc 48 ent1) ent1))
    (setq ed (subst opt1 ent2 ent1))
    (entmod ed) ; >>>still
    problem here !!!
    (entupd ent1)
    (princ)
    )
     
    Adesu, Sep 10, 2004
    #1
  2. Adesu

    BillZ Guest

    Adesu,

    (setq ent1 (vlax-ename->vla-object (car (entsel "\nSELECT LINE: "))))
    (setq opt (getreal "\nENTER NUMBER FOR NEW SCALE
    LINE: "))

    (vla-put-linetypescale ent1 opt)

    Much easier.

    HTH

    Bill
     
    BillZ, Sep 10, 2004
    #2
  3. Adesu

    moshe Guest

    Hi Adesu

    Here is th correction to bottom of the code:-

    (setq opt (getreal "\nENTER NUMBER FOR NEW SCALE LINE: "))
    (setq opt1 (subst (cons 48 opt)(assoc 48 ent1) ent1))
    (entmod opt1)
    (princ)


    This sould work...

    Good Luck

    Moshe
     
    moshe, Sep 10, 2004
    #3
  4. Ade,

    Compare this with what you have. You had some extra steps that
    weren't really needed.

    (defun c:esl (/ ent entdata opt)
    (while (not ent)
    (setq ent (entsel "\nSELECT LINE: "))
    )
    (setq entdata (entget (car ent)))
    (if (not (assoc 48 entdata))
    (alert (strcat "\nATTENTION"
    "\n1).You must load linetype"
    "\n2).Set a linetype by x value"
    "\n2). Run this program"
    )
    )
    (progn
    (initget 1)
    (setq opt (getreal "\nENTER NUMBER FOR NEW SCALE LINE: "))
    (setq entdata (subst (cons 48 opt) (assoc 48 entdata) entdata))
    (entmod entdata)
    (entupd (car ent))
    )
    )
    (princ)
    )

    --
    Ken Alexander
    Acad2004
    Windows XP

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein
     
    Ken Alexander, Sep 10, 2004
    #4
  5. Adesu

    Adesu Guest

    Hi BillZ,good idea for to start learn about "vlax",now I not yet familiar
    with vla..vlax..etc,next time I'm learning how to use vla & vlax,thanks a
    lot for your reply,I like that simple and easy to catch it.
     
    Adesu, Sep 14, 2004
    #5
  6. Adesu

    Adesu Guest

    Hi moshe,thanks a lot your correction that right

     
    Adesu, Sep 14, 2004
    #6
  7. Adesu

    Adesu Guest

    Hi Ken,thanks a lot for your reply
     
    Adesu, Sep 14, 2004
    #7
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.