Results 1 to 10 of 10

Thread: Rotate based on Viewtwist

  1. #1
    Member
    Join Date
    2009-02
    Posts
    40
    Login to Give a bone
    0

    Default Rotate based on Viewtwist

    I've set up a LISP to rotate a block based on the viewtwist, but I'm trying to get it to be at 90 degrees of the current twist. Is there a way modify the viewtwist value number to where it will take the value and then add 90 to it?

  2. #2
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    Radians:
    Code:
     (+ (getvar 'viewtwist) (/ pi 2.))

  3. #3
    Member
    Join Date
    2009-02
    Posts
    40
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    Thanks, got it. Figured it was something with pi.

    Last question regarding this specific lisp I am working on.

    Is there a VLA command that will only run a program based on a what is within the current viewport, and not everything in model space?

    Code:
    (defun RotateStationing ()
      (setq staBlockName (mapcar (function strcase)
                              '("fiber marker tube-sta")))  
      (setq vwPort (+ (- (getvar "viewtwist")) (/ pi 2)))  
      (if (setq ss (ssget "_X"
                          (list '(0 . "INSERT")
                                (cons 2
                                      (apply (function strcat)
                                             (cons "`*U*,"
                                                   (mapcar (function (lambda (s) (strcat s ",")))
                                                           staBlockName)))))))
    	     (progn
          (vlax-for x (setq ss (vla-get-activeselectionset
                                 (cond (*ACADdoc*)
                                       ((setq *ACADdoc* (vla-get-activeviewport
                                                          (vlax-get-acad-object)))))))
            (if (and (vl-position
                       (strcase (vlax-get-property
                                  x
                                  (if (vlax-property-available-p x 'EffectiveName)
                                    'EffectiveName
                                    'Name)))
                       staBlockName)
                     (eq (vla-get-isDynamicBlock x) :vlax-true))
              (vl-some (function (lambda (p)
                                   (if (eq (vlax-get-property p "PropertyName") "Stationing Angle")
                                     (not (vl-catch-all-error-p
                                            (vl-catch-all-apply
                                              (function vlax-put-property)
                                              (list p "Value" vwPort)))))))
                       (vlax-invoke x 'GetDynamicBlockProperties))))
          (vla-delete ss)))
      (princ)
    )

    I tried modifying this code with vla-get-activeviewport, thinking it would do that, but of course I was wrong.

  4. #4
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    Quote Originally Posted by Ohnoto View Post
    Thanks, got it. Figured it was something with pi.

    Last question regarding this specific lisp I am working on.

    Is there a VLA command that will only run a program based on a what is within the current viewport, and not everything in model space?

    Code:
    (defun RotateStationing ()
      (setq staBlockName (mapcar (function strcase)
                              '("fiber marker tube-sta")))  
      (setq vwPort (+ (- (getvar "viewtwist")) (/ pi 2)))  
      (if (setq ss (ssget "_X"
                          (list '(0 . "INSERT")
                                (cons 2
                                      (apply (function strcat)
                                             (cons "`*U*,"
                                                   (mapcar (function (lambda (s) (strcat s ",")))
                                                           staBlockName)))))))
             (progn
          (vlax-for x (setq ss (vla-get-activeselectionset
                                 (cond (*ACADdoc*)
                                       ((setq *ACADdoc* (vla-get-activeviewport
                                                          (vlax-get-acad-object)))))))
            (if (and (vl-position
                       (strcase (vlax-get-property
                                  x
                                  (if (vlax-property-available-p x 'EffectiveName)
                                    'EffectiveName
                                    'Name)))
                       staBlockName)
                     (eq (vla-get-isDynamicBlock x) :vlax-true))
              (vl-some (function (lambda (p)
                                   (if (eq (vlax-get-property p "PropertyName") "Stationing Angle")
                                     (not (vl-catch-all-error-p
                                            (vl-catch-all-apply
                                              (function vlax-put-property)
                                              (list p "Value" vwPort)))))))
                       (vlax-invoke x 'GetDynamicBlockProperties))))
          (vla-delete ss)))
      (princ)
    )
    I tried modifying this code with vla-get-activeviewport, thinking it would do that, but of course I was wrong.
    You'd have to trans the coordinates of the viewport to model and ssget with C/W/WP/CP (whichever one suites you).

  5. #5
    Member
    Join Date
    2009-02
    Posts
    40
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    There is no consistency with that here, so I just took out the "_X" after the SSGET function, and that works perfect since the user can just group select what they want to adjust.

  6. #6
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    Quote Originally Posted by Ohnoto View Post
    There is no consistency with that here, so I just took out the "_X" after the SSGET function, and that works perfect since the user can just group select what they want to adjust.
    No, you select the viewport and translate it's coordinates to model.

  7. #7
    Member
    Join Date
    2009-02
    Posts
    40
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    Yeah, but what I meant was that for what we do here, the change I did works great for us.

  8. #8
    Member
    Join Date
    2009-02
    Posts
    40
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    I'm having issues with this now, in that if a block is rotated an any other angle than 0, it won't rotate it properly. It rotates it at 90 degrees of its inserted angle, and not 90 degrees of the viewport angle.

    Maybe it's the trans, but I'm not sure where that would go in the coding.
    Attached Files Attached Files

  9. #9
    100 Club
    Join Date
    2009-07
    Posts
    103
    Login to Give a bone
    0

    Smile Re: Rotate based on Viewtwist

    if any are interested i have a lisp routine that works great in both model space and in a view port. i use this a lot in my view ports it does a dviewtwist in the view port and leave the original layout in model space.

  10. #10
    Member
    Join Date
    2009-02
    Posts
    40
    Login to Give a bone
    0

    Default Re: Rotate based on Viewtwist

    DVTwist isn't what I'm really looking for, but may be useful for others.

    Still trying to get this figured out though, since it appears that these blocks rotate based on their insertion angle and not the viewport angle.

Similar Threads

  1. Rotate Project North does not rotate the Design Options
    By weston in forum Revit Architecture - General
    Replies: 5
    Last Post: 2009-11-05, 05:22 PM
  2. How do you changing a wall based family into a face based one
    By speedfreak5150 in forum Revit Architecture - General
    Replies: 2
    Last Post: 2009-07-13, 05:21 AM
  3. Need a wall-based family that can rotate
    By patricks in forum Revit Architecture - Families
    Replies: 6
    Last Post: 2008-09-21, 07:41 PM
  4. join rotate block at base point + rotate atribute??
    By killerdemaster in forum AutoLISP
    Replies: 0
    Last Post: 2008-01-14, 05:10 PM
  5. Can't rotate crop regions to rotate view
    By Wes Macaulay in forum Revit Architecture - General
    Replies: 11
    Last Post: 2005-02-07, 04:46 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
  •