+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Senior Member
    Using
    Civil 3D 2009
    Join Date
    Feb 2010
    Posts
    104

    Default Edited Bored LISP

    Registered forum members do not see this ad.

    I recieved a lisp from Lee Mac. Bored.lsp

    Code is as follows:

    Code:
     
    (defun c:bored ( / cir cnt gr lst n d )
      ;; © Lee Mac 2010
      (setq lst (list (getvar 'viewctr) (getvar 'viewctr)) cnt 0)
     
      (while (eq 5 (car (setq gr (grread nil 13 0))))
        (redraw)
        (setq cir nil n 0 lst (append lst (list (last lst) (cadr gr)))
              cnt (1+ cnt))
     
        (if (< 100 cnt) (setq lst (cddr lst)))
     
        (repeat 50
          (setq d (/ (distance (car lst) (last lst)) 4.))
          (repeat 4
            (setq cir (cons (polar (car lst) (* (setq n (1+ n)) (/ (* pi 2) 50)) d) cir))
            (setq d (/ d 2.))
          )
        )
        (grvecs (append (list (rem (/ cnt 100) 255)) lst cir))
      )
      (redraw)
      (princ)
    )
    Now, I have edited it to drag around an object, code as follows:

    Code:
    (defun c:bored2 ( / )
      ;; © Lee Mac 2010
      ;Edit by Hippe 2010
      (setq obj (vlax-ename->vla-object (car (entsel))))
      (setq ins (vlax-get-property obj 'InsertionPoint))
      (setq lst (list (getvar 'viewctr) (getvar 'viewctr)) cnt 0)
     
      (while (eq 5 (car (setq gr (grread nil 13 0))))
        (redraw)
        (setq cir nil n 0 lst (append lst (list (last lst) (cadr gr)))
              cnt (1+ cnt))
     
        (if (< 100 cnt) (setq lst (cddr lst)))
     
        ;(repeat 50
         ; (setq d (/ (distance (car lst) (last lst)) 4.))
          ;(repeat 4
           ; (setq cir (cons (polar (car lst) (* (setq n (1+ n)) (/ (* pi 2) 50)) d) cir))
          ;  (setq d (/ d 2.))
         ; )
        ;)
        (grvecs (append (list (rem (/ cnt 100) 255)) lst cir))
        (vlax-put-property obj 'InsertionPoint (vlax-3d-point (nth 0 lst)))
        (vla-update obj)
     
      )
      (redraw)
      (vlax-put-property obj 'InsertionPoint ins)
      (vlax-release-object obj)
      (princ)
    )
    This code should work with any object that has an Insertion Point Property.

    Now my question is: This works with a piece of single line text with a left justification, but doesn't seem to work with a Middle Center Justification. Can anyone see why it doesn't work?

    Thanks in advance.

    hippe013

    P.S. Lee Mac... thanx again, fun stuff!

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,741

    Default

    Hint: Read up on vla-get-insertionPoint for text.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  3. #3
    Senior Member
    Using
    Civil 3D 2009
    Join Date
    Feb 2010
    Posts
    104

    Default

    Thanks for the quick reply!

    I've tried using the TextAlignmentPoint property instead and it works. Though my question is that why is that I am not able to move the object by changing the InsertionPoint property?

  4. #4
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,741

    Default

    Quote Originally Posted by Hippe013 View Post
    I've tried using the TextAlignmentPoint property instead and it works. Though my question is that why is that I am not able to move the object by changing the InsertionPoint property?
    Did you read the Dev Help Notes?
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  5. #5
    Senior Member
    Using
    Civil 3D 2009
    Join Date
    Feb 2010
    Posts
    104

    Default

    Yes, I am in the process of reading them now. I am no stranger to the help files! Though I am having a hard time finding where they explain the both.

  6. #6
    Senior Member
    Using
    Civil 3D 2009
    Join Date
    Feb 2010
    Posts
    104

    Default

    Found it! Thanks.


    For the readers:

    TextAlignmentPoint
    Text: This property will be reset to 0, 0, 0 and will become read-only when the Alignment property is set to acAlignmentLeft. To position text whose justification is left, fit, or aligned, use the InsertionPoint property.

    InsertionPoint
    Text: This property is read-only except for text whose Alignment property is set to acAlignmentLeft, acAlignmentAligned, or acAlignmentFit. To position text whose justification is other than left, aligned, or fit, use the TextAlignmentPoint property.
    Last edited by Hippe013; 23rd Jul 2010 at 09:26 pm. Reason: Added Help Information

  7. #7
    Senior Member
    Using
    Civil 3D 2009
    Join Date
    Feb 2010
    Posts
    104

    Default

    Note:
    Code:
    (vlax-property-available-p obj 'InsertionPoint T)
    With the obj (text object) being Left justified or Middle Center justfied vlax-property-available-p (with check-modify set to T) will still return True. Which it seems to me that it shouldn't... any ideas about this?

  8. #8
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,741

    Default

    Yes of course it will return T, the properties are independent of each other and dependent on the Object.

    Just check the Alignment to see which to use.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  9. #9
    Senior Member
    Using
    Civil 3D 2009
    Join Date
    Feb 2010
    Posts
    104

    Default

    I would have to agree and checking the alignment to see which to use is obviously the route to go. Though it would stand to reason that if one property becomes read-only dependent on the value of the alignment that vlax-property-available-p would pick up on that fact that the value has now become read-only and return nil. Wouldn't you agree Lee?

  10. #10
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,741

    Default

    Registered forum members do not see this ad.

    It doesn't become read-only - it just has no effect on position.
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

Similar Threads

  1. Annotative, attribute dynamic block cannot be edited
    By taiwanchu in forum AutoCAD Bugs, Error Messages & Quirks
    Replies: 13
    Last Post: 11th Feb 2010, 04:18 pm
  2. Can the panels in AA2010 be edited?
    By warren architecture in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 4
    Last Post: 7th Dec 2009, 04:59 pm
  3. Make Dimension's Edited Dimensions
    By BLOACH85 in forum AutoLISP, Visual LISP & DCL
    Replies: 12
    Last Post: 8th Jul 2009, 08:00 pm
  4. A LISP for when you are bored...
    By Lee Mac in forum AutoLISP, Visual LISP & DCL
    Replies: 13
    Last Post: 28th May 2009, 08:26 pm
  5. updating edited parts in an assembly
    By bigmousepusher in forum Autodesk Inventor
    Replies: 12
    Last Post: 8th Apr 2009, 02:53 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts