VLisp Mtext Justification Property

Discussion in 'AutoCAD' started by Chandan, Jan 10, 2005.

  1. Chandan

    Chandan Guest

    How I Set the Justification Property of a Mtext entity, through Visual Lisp.

    (setq Obj (vla-addMText *WorkSpace* (vlax-3d-point StartPt) MTextHeight InputString))

    (vlax-put-property Obj '?????? MiddleCenter)


    Chandan
     
    Chandan, Jan 10, 2005
    #1
  2. Chandan

    MP Guest

    AlignmentPoint
     
    MP, Jan 10, 2005
    #2
  3. Chandan

    Chandan Guest

    VLisp Mtext Justification Property “AlignmentPoint†not working.

    The flowing error occurs when I execute the syntax:

    (vlax-put-property Obj 'AlignmentPoint "MiddleCenter")

    ; error: ActiveX Server returned the error: unknown name: ALIGNMENTPOINT
     
    Chandan, Jan 11, 2005
    #3
  4. Chandan

    Chandan Guest

    Sir, please check this function:

    ;;; Create Any Mtext Entity
    (defun CreateMtextEntity (StartPt InputString MTextHeight MTextWidth MTextJustify MTextLayer / *ModelSpace* Obj)
    (if (= (getvar "TILEMODE") 1)
    (setq *WorkSpace* (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-Acad-Object))))
    (setq *WorkSpace* (vla-get-PaperSpace (vla-get-ActiveDocument (vlax-get-Acad-Object))))
    )
    (setq Obj (vla-addMText *WorkSpace* (vlax-3d-point StartPt) MTextHeight InputString))
    (vlax-put-property Obj 'Height MTextHeight)
    (vlax-put-property Obj 'StyleName "STANDARD")
    (vlax-put-property Obj 'Layer MTextLayer)
    (vlax-put-property Obj 'Lineweight 0)
    (vlax-put-property Obj 'Width MTextWidth)
    ;***** Checking Require *****
    (vlax-put-property Obj 'AlignmentPoint MTextJustify) ;***** Checking Require *****
    ;***** Checking Require *****
    (vlax-release-object Obj)
    (gc)
    )

    (defun C:TT ()
    (setq Pt (getpoint "Pick a Point: ")
    InputString "SECTION WEIGHT FOR DRAWING NO: XXXXXXXXXXXXXXXXXXXXXX"
    MTextHeight 5.0
    MTextWidth 175.0
    MTextJustify "MiddleCenter"
    MTextLayer "Layer1")
    (CreateMtextEntity Pt InputString MTextHeight MTextWidth MTextJustify MTextLayer)
    )

    (C:TT)
     
    Chandan, Jan 11, 2005
    #4
  5. Look at the MText object in the ActiveX Reference.

    --
    R. Robert Bell


    Sir, please check this function:

    ;;; Create Any Mtext Entity
    (defun CreateMtextEntity (StartPt InputString MTextHeight MTextWidth
    MTextJustify MTextLayer / *ModelSpace* Obj)
    (if (= (getvar "TILEMODE") 1)
    (setq *WorkSpace* (vla-get-ModelSpace (vla-get-ActiveDocument
    (vlax-get-Acad-Object))))
    (setq *WorkSpace* (vla-get-PaperSpace (vla-get-ActiveDocument
    (vlax-get-Acad-Object))))
    )
    (setq Obj (vla-addMText *WorkSpace* (vlax-3d-point StartPt) MTextHeight
    InputString))
    (vlax-put-property Obj 'Height MTextHeight)
    (vlax-put-property Obj 'StyleName "STANDARD")
    (vlax-put-property Obj 'Layer MTextLayer)
    (vlax-put-property Obj 'Lineweight 0)
    (vlax-put-property Obj 'Width MTextWidth)
    ;***** Checking Require *****
    (vlax-put-property Obj 'AlignmentPoint MTextJustify) ;***** Checking
    Require *****
    ;***** Checking Require *****
    (vlax-release-object Obj)
    (gc)
    )

    (defun C:TT ()
    (setq Pt (getpoint "Pick a Point: ")
    InputString "SECTION WEIGHT FOR DRAWING NO: XXXXXXXXXXXXXXXXXXXXXX"
    MTextHeight 5.0
    MTextWidth 175.0
    MTextJustify "MiddleCenter"
    MTextLayer "Layer1")
    (CreateMtextEntity Pt InputString MTextHeight MTextWidth MTextJustify
    MTextLayer)
    )

    (C:TT)
     
    R. Robert Bell, Jan 11, 2005
    #5
  6. Chandan

    Jeff Mishler Guest

    Mark led you astray........you want the AttachmentPoint for Mtext objects
     
    Jeff Mishler, Jan 11, 2005
    #6
  7. Chandan

    MP Guest

    oops sorry
    :-\


     
    MP, Jan 12, 2005
    #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.