Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22

Thread: Rotate multiple blocks about the insertion point to global fixed point.

  1. #11
    100 Club
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    116
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Quote Originally Posted by feargt View Post
    Hi GHarvey,

    Thanks for your help. This works in principle although there appears to be a little problem in that each block rotates what appears to be an extra 90 degrees.....any ideas?
    My code assumes that the arrow block points in the same direction as its rotation value; that is, insert it at zero rotation and it will point to the right. I guess that your block points 90 degrees from this. If this is the case, the following should fix the issue.

    Code:
    (defun c:pointat ( / ARRW-N ARRWS N N-PT NUM PTA)
      (vl-load-com)
      (if (setq arrws (ssget '((0 . "INSERT")))
    	    ); setq
        (progn
          (setq num (sslength arrws)
    	    pta (getpoint "\nPick the Target... ")
    	    n 0
    	    ); setq
          (while (< n num)
    	(setq arrw-n (vlax-ename->vla-object (ssname arrws n))
    	      n-pt (vlax-get arrw-n 'insertionpoint)
    	      n (1+ n)
    	      ); setq
    	(vla-put-rotation arrw-n (- (angle n-pt pta) (/ pi 2.0)))
    	); while
          ); progn
        (prompt "\nNo blocks selected. ")
        ); if
      (princ)
      ); defun

  2. #12
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    That puzzle looks like too much fun so I have to throw in this grread version.

    (It rotates the blocks dynamically)



    P-

    *** (I fixed the ending error mentioned below see new attachment for arwx2.lsp)***
    Attached Files Attached Files
    Last edited by peter; 2012-10-04 at 12:41 AM.
    AutomateCAD

  3. #13
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Quote Originally Posted by peter View Post
    (It rotates the blocks dynamically)
    Hi,

    The code throw an error when a user pick a point to end the process , and as you know all that because of feed in of the while function .

  4. #14
    100 Club
    Join Date
    2015-09
    Posts
    154
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Hi Peter,

    I'm glad the puzzle was entertaining for you. Although when I tested your lisp nothing happened. I tested it on the drawing attached, and also on my drawing where I changed the block name fron arx to the name of my block. End result was as follows.

    Command: arwx2

    Command:

    There was no request for any user input and nothing changed on the screen graphically........Am I missing something????

    Thanks
    no request for user input or target

  5. #15
    100 Club
    Join Date
    2015-09
    Posts
    154
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Hi GHarvey,

    Thanks for taking the time to optimise the code. Works a charm.

    Thanks!

  6. #16
    Member
    Join Date
    2007-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Would it work if I ever want to go drehn 90 degrees.

    Würde das auch gehn wenn ich immer um 90 Grad drehn will.

    Danke

  7. #17
    100 Club
    Join Date
    2015-09
    Posts
    154
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Hi Heinz,

    Was meinen Sie genau? Meinen Sie ob es alle blöcke um 90 Grad drehen kann egal welche drehung sie jezt haben?

  8. #18
    Member
    Join Date
    2007-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    I'd love to
    when I press the Tab key
    the object will always be rotated by 90 degrees.

    Ich würde das gerne machen
    wenn ich die Tab Taste drücke
    das das Objekt immer um 90 Grad gedreht wird.

    Hintergrund ist der, ich will das Objekt kopieren oder schieben, und während kopieren oder schieben das Objekt mit der Tab Taste drehnen können.

    Danke
    Last edited by heinz.dober; 2012-10-04 at 07:04 AM.

  9. #19
    100 Club
    Join Date
    2015-09
    Posts
    154
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Hi Heinz,

    haben Sie die Express tools geladen?

    folgende lisp ist einfach 2 makros die die Express befehl Moroco verwenden. Sie werden das Objekt um 90 Grad drehen (nach kopieren oder schieben).

    [code]
    (defun c:md (/ )
    (command "_mocoro" Pause "" Pause "m" Pause "r" "90" "")
    )

    (defun c:cd (/ )
    (command "_mocoro" Pause "" Pause "c" Pause "" "r" "90" "")
    )
    [code]

    Wenn das ist nicht was Sie brauchen dann bitte eine neue Post starten.
    Last edited by feargt; 2012-10-04 at 07:42 AM.

  10. #20
    Member
    Join Date
    2007-10
    Posts
    5
    Login to Give a bone
    0

    Default Re: Rotate multiple blocks about the insertion point to global fixed point.

    Nein das ist es nicht, aber so ähnlich.

    (defun c:cd (/ )
    (command "_mocoro" Pause "" Pause "c" Pause "" "r" Pause "m" Pause "")
    )

    Danke

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Rotate objects by insertion point
    By spattn in forum VBA/COM Interop
    Replies: 6
    Last Post: 2011-11-05, 05:24 AM
  2. Display cooridinates of a blocks insertion point
    By JH75 in forum Dynamic Blocks - Technical
    Replies: 1
    Last Post: 2009-01-06, 05:06 AM
  3. Pick to Rotate at Insertion point
    By BCrouse in forum AutoLISP
    Replies: 5
    Last Post: 2007-07-13, 09:22 PM
  4. Select blocks by name and insertion point?
    By keelay711 in forum AutoLISP
    Replies: 17
    Last Post: 2006-10-17, 12:03 PM

Posting Permissions

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