Jump to content

block place near of the end of line


Guest cad2007

Recommended Posts

Guest cad2007

in line end we can possible to fix the block..like i am selecting one line,its need to take which side is near end that side my given ""block"" need to be place.....

Link to comment
Share on other sites

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    9

  • Tharwat

    7

  • mdbdesign

    5

Top Posters In This Topic

Posted Images

Guest cad2007

BlockPLace_Online end.JPG

ummmm.....what?

Due to an obvious language barrier, post an image/drawing showing the before and after result.

 

Here i have attached one image....i am selecting one line means its need to measure from center and which side near of end(or Start) that side block should be place..After my selection its need to ask block name.After we r giving block name means irs need to be place.....

Link to comment
Share on other sites

[ATTACH]24298[/ATTACH]

 

Here i have attached one image....i am selecting one line means its need to measure from center and which side near of end(or Start) that side block should be place..After my selection its need to ask block name.After we r giving block name means irs need to be place.....

Are you also selecting the block to 'insert' at the end/start point?

Link to comment
Share on other sites

Guest cad2007

in that time i cannt able chk which one start or which side end...in that time From center its need to consider nearest start(or end) points....

 

Like i am selecting one line so its consider that nearest start or end of line....

Link to comment
Share on other sites

You can use vlax-curve-getStartPoint and vlax-curve-getEndPoint and sort with vl-sort, based on shortest distance the given point and the end/start point, then just take the first item in the list.

 

eg.

(car (vl-sort (list (vlax-curve-getStartPoint <EName>) (vlax-curve-getEndPoint <EName>))
             (function (lambda (a b) (< (distance <Point> a) (distance <Point> b))))
    )
)

Link to comment
Share on other sites

Guest cad2007

its showing error.; error: An error has occurred inside the *error* functionAutoCAD

variable setting rejected: "filletrad" nil..

with comand only we can acess..??other wise we cannt use

Link to comment
Share on other sites

You may find these codes helpful . :)

 

(defun c:THib (/ ss start end e lst answer)
 ; THARWAT Nov.02.2010
 (if (setq ss (car(entsel "\n Select Line :")))
   (progn
     (setq start (cdr (assoc 10 (setq e (entget ss)))))
      (setq end (cdr (assoc 11 e)))
     (entmakex (list (cons 0 "INSERT")
		(cons 2 "[b][color="red"]YourBlockName[/color][/b]")
		(cons 10 start)
		))
             (setq lst (entlast))
                 (initget "Yes No")
                    (setq answer (getkword "\n Agree with this side [Yes/No] :"))
                      (if (eq answer "No")
                 (progn
                   (entdel lst)
                           (entmakex (list (cons 0 "INSERT")
	    	      (cons 2 "[b][color="red"]YourBlockName[/color][/b]")
		      (cons 10 end)
		      (cons 50 3.14159)))
                )
               (princ)
                )
                 )
         (princ)
      )
 )

 

Tharwat

Link to comment
Share on other sites

Guest cad2007

i have tried...but there is no option for block insert...and one more here Agree with this side i am given no means its deleting mt selected line....So here i want to fix block insert option.which block i am giving that block need to place in nearest start or end of the line..........

Link to comment
Share on other sites

Guest cad2007
Try this, no defun reqired

^C^C-insert;\end;\;;\

It give you option to select closest end and rotation

 

i want to add this to this codes???where i want to add??this??

Link to comment
Share on other sites

here hw to fix the defun command...???and for block asking?
Seriously?!? So, basically, you have no coding experience and you are just wanting handouts.

 

You may find these codes helpful . :)

 

(defun c:THib (/ ss start end e lst answer)
 ; THARWAT Nov.02.2010
 (if (setq ss (car(entsel "\n Select Line :")))
   (progn
     (setq start (cdr (assoc 10 (setq e (entget ss)))))
      (setq end (cdr (assoc 11 e)))
        (entmakex (list (cons 0 "INSERT")
           (cons 2 "[b][color=red]YourBlockName[/color][/b]")
           (cons 10 start)
           ))
             (setq lst (entlast))
                 (initget "Yes No")
                    (setq answer (getkword "\n Agree with this side [Yes/No] :"))
                      (if (eq answer "No")
                    (progn
                      (entdel lst)
                           (entmakex (list (cons 0 "INSERT")
                     (cons 2 "[b][color=red]YourBlockName[/color][/b]")
                 (cons 10 end)
                 (cons 50 3.14159)))
                   )
                  (princ)
                   )
                 )
         (princ)
      )
 )

Tharwat

You can save some headache by just entmod'ing the insertion point instead of deleting and recreating.

Link to comment
Share on other sites

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...