Jump to content

Circle inside the Block


wimal

Recommended Posts

;;;............FIND DETAILS OF CIRCLE INSIDE A BLOCK.........................

How can I  get the present location of the circle.[/quote]


if direction normal & 2D circle (1st level nested), try this simple conversion..
[code]

[color="green"];vlisp [/color]
(defun PtInsideBlock (en p / ob bp l )
 (setq	bp '(0. 0.)
ob (vlax-ename->vla-object en)
l  (mapcar ''((x) (vlax-get ob x))
	   (vl-list* 'ObjectName
		     'InsertionPoint
		     'Rotation
		     (mapcar ''((x) (strcat x "Effectivescalefactor")) '( "X" "Y" ))
		     ) 
	   )
p  (mapcar '* p (cdddr l))
) 
 (if (= (car l) "AcDbBlockReference")
  (mapcar '+ (cadr l) (polar bp (+ (angle bp p) (caddr l)) (distance bp p))
    ) 
   ) 
 ) 


[color="green"];pure vanilla [/color]
(defun PtInsideBlock (e p / bp e l )
 (setq bp '(0. 0.)
e (entget e)
 	l (mapcar ''((x)(cdr (assoc x e))) '(0 10 50 41 42 ))
p (mapcar '* p (cdddr l))
)
 (if (= (car l) "INSERT")
   (mapcar '+ (cadr l) (polar bp (+ (angle bp p) (caddr l)) (distance bp p))
)
   )
 )

 

assign en variable

(repeat (setq i (sslength xss2))
 (setq e(entget (setq [b][color="red"][u]en[/u][/color][/b] (ssname xss2 (setq i (1- i))))))
...
...
...
[color="red"](setq [b]center[/b] (cdr (assoc 10 get)))

(princ (strcat "\nCenter = "(vl-princ-to-string ([color="blue"]PtInsideBlock[/color] [b][u]en[/u][/b] [b]center[/b] ))))
[/color]
...
...
...

minimal tested which supports block with & w/out uniform scale

Edited by hanhphuc
vanilla code added
Link to comment
Share on other sites

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • wimal

    7

  • dlanorh

    7

  • Tharwat

    5

  • BIGAL

    1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...