Dim line forced

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

  1. Adesu

    Adesu Guest

    Hi Alls,I've got trouble to execute "Dim line forced" ,what suitable name
    for joint with vlax-get-property ,thanks a lot.

    _$ (vl-load-com)
    (setq ent
    (vlax-ename->vla-object
    (car
    (entsel "\nSELECT A DIMENSION: "))))

    #<VLA-OBJECT IAcadDimRotated 01aaba84>

    _$ (setq ent1 (rtos (vlax-get-property ent "dimlineforced")))
    ; error: ActiveX Server returned the error: unknown name: dimlineforced

    _$ (setq ent1 (rtos (vlax-get-property ent "dim line forced")))
    ; error: ActiveX Server returned the error: unknown name: dim line forced

    _$ (setq ent1 (rtos (vlax-get-property ent "line forced")))
    ; error: ActiveX Server returned the error: unknown name: line forced

    _$ (setq ent1 (rtos (vlax-get-property ent "forced")))
    ; error: ActiveX Server returned the error: unknown name: forced
     
    Adesu, Sep 27, 2004
    #1
  2. Adesu

    Doug Broad Guest

    Adesu,
    Finding this kind of information is easy. Use VLIDE, then F1.
    Then select Contents, then "ActiveX and VBA Reference".
    Choose Object model.
    Click on DimRotated

    You will see all the properties and methods available for any object type.
    "Dimlineforced" and your other variants are not valid properties.

    Use one that is. You should be able to find it.

    Also to find out available properties use
    (vlax-dump-object <object>)
     
    Doug Broad, Sep 27, 2004
    #2
  3. Adesu

    Adesu Guest

    Hi Doug Broad ,your advice is good and I understand,but I still got problem
    and how solve "vlax-false to become ( on or off).

    $ (vl-load-com)
    (setq ent
    (vlax-ename->vla-object
    (car
    (entsel "\nSELECT A DIMENSION: "))))
    (setq ent1 (vlax-get-property ent "ForceLineInside"))
    (setq opt
    (getstring
    (strcat "\nENTER NEW SETTING FOR FORCELINEINSIDE" "<" ent1 ">" ": ")))
    #<VLA-OBJECT IAcadDimRotated 01abef84>
    :vlax-false
    ; error: bad argument type: stringp :vlax-false
    _$ (setq ent1 (vlax-get-property ent "ForceLineInside"))
    :vlax-false
     
    Adesu, Sep 27, 2004
    #3
  4. Adesu

    Doug Broad Guest

    Adesu,
    Read the error message. The cause of the problem should
    be apparent. :vlax-true and :vlax-false are not strings.
    Only strings can be used in strcat. Figure out a different way
    to give the user options.

    Sounds like you're wasting your time though. What does your
    program do that dimoverride or DIM OV doesn't?
    With those capabilities you can just use 0 or 1.
     
    Doug Broad, Sep 27, 2004
    #4
  5. Adesu

    Adesu Guest

    Hi Doug Broad ,I was solve this problem,this my code below

    ; elf is stand for edit dim line forced dimension
    ; Design by Ade Suharna <>
    ; 27 September 2004
    ; program no. 88/09/2004
    ; Edit by Ade Suharna 28/09/2004
    (defun c:elf (/ ent opt)
    (vl-load-com)
    (setq ent
    (vlax-ename->vla-object
    (car
    (entsel "\nSELECT A DIMENSION: "))))
    (prompt "\nForce Line Inside is ON = 1 ; Force Line Inside is OF =0 ")
    (setq opt
    (getstring "\nENTER NEW SETTING FOR FORCE LINE INSIDE: "))
    (vla-put-ForceLineInside ent opt)
    (princ)
    )
    But I not yet satisfied,how to change "vlax-true" to 1 and "vlax-false" to
    0,I would put in " (setq opt
    (getstring "\nENTER NEW SETTING FOR FORCE LINE INSIDE" "<" ent1 ">" ": "))
    (setq ent1 (data from ent)),can you help me,thanks.
     
    Adesu, Sep 28, 2004
    #5
  6. Adesu

    MP Guest

    (initget "1 0")
    (setq opt(getstring "\nENTER NEW SETTING FOR FORCE LINE INSIDE: "))
    (cond
    ((= opt "1") (vla-put-ForceLineInside ent :vlax-true))
    ((= opt "0") (vla-put-ForceLineInside ent :vlax-false))
    (1 (princ"\nInvalid entry"))
    )

    hth
    Mark P
     
    MP, Sep 28, 2004
    #6
  7. Adesu

    Doug Broad Guest

    Adesu,
    Vlisp is not always the best answer for a particular problem.
    In this case, if all you want to do is to change the format for
    a dimension or group of dimensions, then you should consider
    1) Using dimension styles. This would give you access to making
    consistent looking changes via the dimension toolbar.
    2) Using Dimension mode commands:
    (command "dim1" "ov" "dimtofl" 1 "" pause)
    This does everything that your program does but doesn't piddle
    about with all the complexities of vlisp or the object model.
    It also works on any number of dimensions at the same time.

    Regards,
    Doug

    PS. MP showed a good way to accomplish what you want neatly.
     
    Doug Broad, Sep 28, 2004
    #7
  8. Adesu

    Doug Broad Guest

    And since it sounds like you might be an international customer

    (command "_.dim1" "_ov" "_dimtofl" 1 "" pause)
     
    Doug Broad, Sep 28, 2004
    #8
  9. Adesu

    Adesu Guest

    HI MP & Doug Broad ,thanks a lot as your advice to me,sorry I forgot why not
    used "cond".here my code after revised it.

    ; elf is stand for edit dim line forced dimension
    ; Design by Ade Suharna <>
    ; 27 September 2004
    ; program no. 88/09/2004
    ; Edit by Ade Suharna 28/09/2004
    ; MP <> 29/09/2004
    (defun c:elf (/ ent ent1 ent2 opt)
    (vl-load-com)
    (setq ent
    (vlax-ename->vla-object
    (car
    (entsel "\nSELECT A DIMENSION: "))))
    (setq ent1 (vlax-get-property ent "ForceLineInside"))
    (setq ent2 (cond ((= ent1 :vlax-true)(setq ent2 (rtos 1 2 0)))
    ((= ent1 :vlax-false)(setq ent2 (rtos 0 2 0)))
    )
    )
    (initget "1 0")
    (prompt "\nForce Line Inside is ON = 1 ; Force Line Inside is OF =0 ")
    (setq opt
    (getstring
    (strcat "\nENTER NEW SETTING FOR FORCE LINE INSIDE" "<" ent2 ">" ":")))
    (cond
    ((= opt "1")(vla-put-ForceLineInside ent :vlax-true))
    ((= opt "0")(vla-put-ForceLineInside ent :vlax-false))
    (1 (princ"\nInvalid entry"))
    )
    (vla-put-ForceLineInside ent opt)
    (princ)
    )

    Is it posible still use "(vla-put-ForceLineInside ent opt)" or ???
     
    Adesu, Sep 29, 2004
    #9
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.