+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 19 of 19
  1. #11
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,177

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by wimal View Post
    Code:
    (setq xss2 (ssget"C"pt1 pt2  '((0 . "INSERT") )))
    I mean there are blocks in my selection set. So I cant directly pick on circle to get the diameter.
    Please help me to do that.
    Hi,

    This should print the radius of circles found in the selected blocks:
    Code:
    (if xss2
      (repeat (setq i (sslength xss2))
        (setq obj (tblobjname "BLOCK" (cdr (assoc 2 (entget (ssname xss2 (setq i (1- i))))))))
        (while (setq obj (entnext obj))
          (and (= (cdr (assoc 0 (setq get (entget obj)))) "CIRCLE")
               (print (cdr (assoc 40 get))))
          )
        )
      )

  2. #12
    Full Member
    Discipline
    Surveying
    dlanorh's Discipline Details
    Occupation
    Geospatial Engineer
    Discipline
    Surveying
    Using
    AutoCAD 2012
    Join Date
    Aug 2017
    Location
    UK/Bundesrepublik Deutschland
    Posts
    65

    Default

    Quote Originally Posted by Tharwat View Post
    Hi,

    This should print the radius of circles found in the selected blocks:
    Code:
    (if xss2
      (repeat (setq i (sslength xss2))
        (setq obj (tblobjname "BLOCK" (cdr (assoc 2 (entget (ssname xss2 (setq i (1- i))))))))
        (while (setq obj (entnext obj))
          (and (= (cdr (assoc 0 (setq get (entget obj)))) "CIRCLE")
               (print (cdr (assoc 40 get))))
          )
        )
      )

    If the block is scaled then you need to check if the block is uniformly scaled and if it is, multiple the radius from the block def by the xscalefactor to get the true radius
    Last edited by dlanorh; 17th May 2018 at 10:39 am. Reason: update

  3. #13
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,177

    Default

    Quote Originally Posted by dlanorh View Post
    If the block is scaled then you need to check if the block is uniformly scaled and if it is, multiple the radius from the block def by the xscalefactor to get the true radius
    Right on.

    But it seems is that the OP deleted one of their replies that they mentioned they wanted to get the radius to re-scale the blocks back to scale.

  4. #14
    Full Member
    Discipline
    Surveying
    dlanorh's Discipline Details
    Occupation
    Geospatial Engineer
    Discipline
    Surveying
    Using
    AutoCAD 2012
    Join Date
    Aug 2017
    Location
    UK/Bundesrepublik Deutschland
    Posts
    65

    Default

    Quote Originally Posted by Tharwat View Post
    Right on.

    But it seems is that the OP deleted one of their replies that they mentioned they wanted to get the radius to re-scale the blocks back to scale.

    No wonder i'm confused

  5. #15
    Senior Member
    Discipline
    Construction
    wimal's Discipline Details
    Occupation
    cadoperator
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Oct 2011
    Location
    sri lanka
    Posts
    488

    Default

    Both of you are correct.We need to resize the block with reference to the circle inside the block. Our blocks are always scaled uniformly. So the above code is fulfill our requirements. Thanks for your valuable time and codes.
    Last edited by wimal; 18th May 2018 at 10:08 am.

  6. #16
    Full Member
    Discipline
    Surveying
    dlanorh's Discipline Details
    Occupation
    Geospatial Engineer
    Discipline
    Surveying
    Using
    AutoCAD 2012
    Join Date
    Aug 2017
    Location
    UK/Bundesrepublik Deutschland
    Posts
    65

    Default

    Quote Originally Posted by wimal View Post
    Both of you are correct.We need to resize the block with reference to the circle inside the block. Our blocks are allays scaled uniformly. So the above code is fulfill our requirements. Thanks for your valuable time and codes.
    If you need to check the blocks scale using lisp, check the scale factor


    Code:
    (= (cdr (assoc 41 (entget ent))) 1) ;  for "insert" entity
    
    (= (vla-get-xscalefactor blk_obj) 1);  for blk object

  7. #17
    Senior Member
    Discipline
    Construction
    wimal's Discipline Details
    Occupation
    cadoperator
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Oct 2011
    Location
    sri lanka
    Posts
    488

    Default

    Quote Originally Posted by dlanorh View Post
    If you need to check the blocks scale using lisp, check the scale factor


    Code:
    (= (cdr (assoc 41 (entget ent))) 1) ;  for "insert" entity
    
    (= (vla-get-xscalefactor blk_obj) 1);  for blk object
    Code:
    ;;;............FIND DETAILS OF CIRCLE INSIDE A BLOCK.........................
    (setq xss2 nil)
    (setq pt1 (getpoint"\n Select objects by window "))
    (setq pt2 (getcorner pt1"\n 2nd corner"))
    (setq xss2 (ssget"C"pt1 pt2  '((0 . "INSERT") )))
    (if xss2
      (repeat (setq i (sslength xss2))
      (setq e(entget (ssname xss2 (setq i (1- i)))))
        (setq xscale (cdr(assoc 41 e)))
        (setq obj (tblobjname "BLOCK" (cdr (assoc 2 e))))
       
        (while (setq obj (entnext obj))
          (and (= (cdr (assoc 0 (setq get (entget obj)))) "CIRCLE")
               (setq radius (cdr (assoc 40 get)))
    	   );and
          );while
        );repeat
      );if
    (setq actu_radius (* radius xscale)); present radious of circle
    ;;;.............................................................................

  8. #18
    Luminous Being Tharwat's Avatar
    Discipline
    Mechanical
    Tharwat's Discipline Details
    Occupation
    MEP AutoCAD Draughtsman
    Discipline
    Mechanical
    Details
    HVAC, Drainage, Water Supply, Fire Fighting and a little about Electricity.
    Using
    AutoCAD 2015
    Join Date
    Oct 2009
    Location
    Great Syria , Living in Abu Dhabi
    Posts
    6,177

    Default

    Select similar blocks then from the properties palette you can change the three scales X,Y,Z to 1.0 and that's the shortest way.

  9. #19
    Senior Member
    Discipline
    Construction
    wimal's Discipline Details
    Occupation
    cadoperator
    Discipline
    Construction
    Using
    AutoCAD 2016
    Join Date
    Oct 2011
    Location
    sri lanka
    Posts
    488

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Tharwat View Post
    Select similar blocks then from the properties palette you can change the three scales X,Y,Z to 1.0 and that's the shortest way.
    Good idea. thanks a lot.

Similar Threads

  1. Trim inside circle
    By goonkt in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 12th Jul 2012, 06:28 am
  2. Line inside circle
    By issammesk in forum AutoCAD General
    Replies: 1
    Last Post: 30th Jun 2012, 11:10 am
  3. Trim inside circle
    By Cube3 in forum AutoLISP, Visual LISP & DCL
    Replies: 11
    Last Post: 12th Sep 2007, 07:26 am
  4. Text inside a circle
    By ebjco in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 22nd Nov 2005, 07:38 pm
  5. Text inside a circle
    By ebjco in forum AutoCAD Drawing Management & Output
    Replies: 7
    Last Post: 22nd Nov 2005, 04:27 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