+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Senior Member SunnyTurtle's Avatar
    Computer Details
    SunnyTurtle's Computer Details
    Operating System:
    Win 7 64 bit
    Computer:
    HP 600 Workstation
    CPU:
    Intel(R) Xeon(R) CPU X5650 @ 2.67GHz 2.66GHz
    RAM:
    6GB
    Graphics:
    NVIDIA Quadro FX 4800
    Discipline
    Civil
    SunnyTurtle's Discipline Details
    Occupation
    Drafter CAD Civil
    Discipline
    Civil
    Using
    AutoCAD 2011
    Join Date
    Apr 2011
    Location
    Sydney Australia
    Posts
    112

    Default Find Rotation Angle of a Block

    Registered forum members do not see this ad.

    Hi I think this is a simple question for you guys but how do you find the rotation of a block within a drawing that I know the name. I want to create a new USC that is at the same rotation.

    I have tried Associated List 50 but there does not seem to be a rotation angle in that list is there some way to look into the properties and draw a rotation angle for there

    Here is a the code I tried
    Code:
    (setq vfrt (assoc 50 (entsel "a3m_MS_viewframe_01000")))
    

  2. #2
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,786

    Default

    (setq BLOBJ (entget (car (entsel "\nselect block "))))
    (setq ang (cdr (assoc 50 BLOBJ)))

  3. #3
    Forum Deity Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draftsman
    Discipline
    Mechanical
    Using
    AutoCAD 2014
    Join Date
    Oct 2009
    Location
    Lives in Abu Dhabi
    Posts
    2,627

    Default

    Another ....

    Code:
    (defun c:TesT (/ x s)
      (if
        (setq x (ssget "_x" '((0 . "INSERT") (2 . "a3m_MS_viewframe_01000"))))
         (progn
           (setq s (ssname x 0))
           (alert (strcat (rtos (cdr (assoc 50 (entget s))) 2)
                          " : "
                          "in Radians "
                  )
           )
         )
         (alert "There is no Block holds that name in the drawing")
      )
      (princ)
    )

  4. #4
    Senior Member SunnyTurtle's Avatar
    Computer Details
    SunnyTurtle's Computer Details
    Operating System:
    Win 7 64 bit
    Computer:
    HP 600 Workstation
    CPU:
    Intel(R) Xeon(R) CPU X5650 @ 2.67GHz 2.66GHz
    RAM:
    6GB
    Graphics:
    NVIDIA Quadro FX 4800
    Discipline
    Civil
    SunnyTurtle's Discipline Details
    Occupation
    Drafter CAD Civil
    Discipline
    Civil
    Using
    AutoCAD 2011
    Join Date
    Apr 2011
    Location
    Sydney Australia
    Posts
    112

    Default

    Thankyou Tharwat and BIGAL for your codes. Tharwat Code is great but it was in need of modification to fit into the lisp I’m working on, which changes to ucs to the same as the object with that name.
    BIGAL your code help me understand greatly thankyou

    Here a script that does the same thing but it has not way to error check
    The problem I have is that i have ucs 1000 in most of my drawings and it is correct but some of them have it strangely missing so i need a way to check if the ucs existed I did that with the (if) statement
    Code:
    (ssx) B
    a3m_MS_viewframe_01000
    UCS OB
    L
    NA
    SA
    1000
    ZE
    QSAVE


    Also Thank you to both of you i have learn a great deal more about lisping but trying to replicate a combination of you lisps and mine and i need to read more about what the ss functions did. This is now clear to me.

    I will eventually post the completed lisp but bear with me I’m very slow at this stage

  5. #5
    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,729

    Default

    Hi SunnyTurtle

    Consider that the rotation angle of the block is in Radians, so a conversion may be necessary:

    Code:
    (defun c:test ( / e )
      (if
        (and
          (setq e (car (entsel "\nSelect Block: ")))
          (eq "INSERT" (cdr (assoc 0 (entget e))))
        )
        (command "_.ucs" "_z" (angtos (cdr (assoc 50 (entget e)))))
      )
      (princ)
    )
    However, note that in most cases the 'Object' option may be used to align the UCS:

    Code:
    (defun c:uo nil (command "_.ucs" "_OB" pause) (princ))
    Lee Mac Programming

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

    Just another Swamper

  6. #6
    Senior Member SunnyTurtle's Avatar
    Computer Details
    SunnyTurtle's Computer Details
    Operating System:
    Win 7 64 bit
    Computer:
    HP 600 Workstation
    CPU:
    Intel(R) Xeon(R) CPU X5650 @ 2.67GHz 2.66GHz
    RAM:
    6GB
    Graphics:
    NVIDIA Quadro FX 4800
    Discipline
    Civil
    SunnyTurtle's Discipline Details
    Occupation
    Drafter CAD Civil
    Discipline
    Civil
    Using
    AutoCAD 2011
    Join Date
    Apr 2011
    Location
    Sydney Australia
    Posts
    112

    Default

    Hi all thanks for the help I have now thought more about this. It would be very easy to solve if I run scrips and lisp together. The problem is that I don't even know if it is possible to run scrips from other files in lisp (if I can understand the lisp that does this)

    Here's what I’ve my lisp that would work if I could run scrips within it
    Parts in green are I don't know what to do
    Code:
     
    (defun uvf (/ vf usc1000)
     
      (if;1
    ;test weather a3m_MS_viewframes_01000 excists
        (setq vf (ssget "_x" '((0 . "INSERT") (2 . "a3m_MS_viewframe_01000"))))
     
        (if;2
    ;if true
    ;then test if ucs 1000 excists
          (setq ucs1000 (= "1000" (get ucs name)))
          (run a script from search path)          ;if ture run script 1
          (run other script from search path)     ;if nil run script 2
          );end if;2
     
         (alert "No Viewframe 1:1000 in Drawing")     ;if;1 nil give error message
        );end if;1
      );end defun uvf
    Thank for your help

  7. #7
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,786

    Default

    Rather than run a script run a defun (defun script1 () ...... )

    (script1) ;if ture run script 1
    (script2) ;if nil run script 2

    Its just part of your lisp program you can have as many defuns as you like in a lisp program.

  8. #8
    Senior Member SunnyTurtle's Avatar
    Computer Details
    SunnyTurtle's Computer Details
    Operating System:
    Win 7 64 bit
    Computer:
    HP 600 Workstation
    CPU:
    Intel(R) Xeon(R) CPU X5650 @ 2.67GHz 2.66GHz
    RAM:
    6GB
    Graphics:
    NVIDIA Quadro FX 4800
    Discipline
    Civil
    SunnyTurtle's Discipline Details
    Occupation
    Drafter CAD Civil
    Discipline
    Civil
    Using
    AutoCAD 2011
    Join Date
    Apr 2011
    Location
    Sydney Australia
    Posts
    112

    Default

    That works fine I guess I wasn't thinking outside the box. But my real issue here is this silly ucs command. I can't find a function that will return the ucs name or something that I can check it with in multiple drawings.

  9. #9
    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,729

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by SunnyTurtle View Post
    I can't find a function that will return the ucs name
    Code:
    (getvar 'ucsname)
    Lee Mac Programming

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

    Just another Swamper

Similar Threads

  1. Dynamic Block Rotation
    By RFRUSSO in forum AutoCAD Drawing Management & Output
    Replies: 27
    Last Post: 25th Oct 2012, 07:25 pm
  2. Text Rotation Angle
    By rmwilson in forum AutoCAD Beginners' Area
    Replies: 1
    Last Post: 10th Oct 2009, 06:36 pm
  3. How to find the angle between two points please?
    By facad in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 7th Oct 2008, 01:16 am
  4. startpt endpt - rotation angle??
    By russell84 in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 18th Aug 2008, 05:35 pm
  5. Block/Att Rotation Problem
    By happyunited in forum AutoCAD General
    Replies: 22
    Last Post: 8th Jun 2008, 07:16 pm

Tags for this Thread

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