Jump to content

Recommended Posts

Posted

Following several requests regarding how to modify the program to remove the automatic block rotation, I have updated the program to Version 1.4 to incorporate an option to enable or disable the automatic rotation of the block if a curve object is detected at the block insertion point.

 

The latest version and a full description of the program features can be found here.

 

Lee

  • 3 years later...
  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    27

  • The Buzzard

    7

  • ttray33y

    7

  • ReMark

    6

Top Posters In This Topic

Posted Images

Posted

Hi lee, sir

 

could change break on/off

like rotate on/off

Posted

When deleting the inserted block is it possible to join both end of lines automatically

  • 5 weeks later...
Posted

Hi Master Lee,

If possible, is there a chance you can work with your ABB lisp without the Browse dialog box

(setq blk (getfiled "Select Block" "" "dwg" 16))

, cuz i am trying to create a script for every block in our database.

the script will look something like this.

ABB
B
E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg

after the script it then

Posted
When deleting the inserted block is it possible to join both end of lines automatically

Use the command EE to start

; by PBE
; http://www.cadtutor.net/forum/showthread.php?73328-Joining-2-commands
; erase a block and join the lines that the block broke
(defun c:hint ()
  (if	(setq ss (ssget '((0 . "INSERT"))))
  		(repeat (setq i (sslength ss))
	  	(setq pt  (cdr
			 (assoc  10
			   (entget
			     (setq e (ssname ss (setq i (1- i))))
			   ))))
	  	(command "_rotate" e "" "_non" pt "180")
	  )
    )(princ)
  )

(defun c:ee (/ pea $blk block i ll ur objs p1 p2)
 (vl-load-com)
 (setq pea (getvar 'Peditaccept))
 (setvar 'PeditAccept 1)
 (if (setq $blk (ssget '((0 . "insert"))))
  (repeat (setq i (sslength $blk))
    	(setq e (ssname  $blk (setq i (1- i))))
  	(vla-getboundingbox (vlax-ename->vla-object e) 'll 'ur)
    	(entdel e)
  (setq objs (ssget "C" 
      (setq p1 (vlax-safearray->list ll))
      (setq p2 (vlax-safearray->list ur))
      )
  )
(if (eq (cdr (assoc 0 (entget (ssname objs 0)))) "LWPOLYLINE")
	  (command "_.pedit"  "_m"  objs
		   ""  "_join" "_Joint"
		   "_Both" (distance p1 p2)
		   "" )
	  (command "_.join" (ssname objs 0) (ssname objs 1) "")
	)
    )
   (princ "\nNo Blocks Selected")
   )
  (setvar 'PeditAccept pea)
  (princ)
)

Posted
Hi Master Lee,

If possible, is there a chance you can work with your ABB lisp without the Browse dialog box

(setq blk (getfiled "Select Block" "" "dwg" 16))

, cuz i am trying to create a script for every block in our database.

the script will look something like this.

ABB
B
E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg

after the script it then

 

Copy the following code to the end of my AutoBlockBreak file:

(defun abb ( blk ins / bse ext pth )
   (setq pth (vl-string-translate "/" "\\" (vl-filename-directory blk)) 
         ext (cond ((vl-filename-extension blk)) (".dwg"))
         bse (vl-filename-base blk)
   )
   (if (not (or (= "" pth) (wcmatch pth "*\\")))
       (setq pth (strcat pth "\\"))
   )
   (cond
       (   (= 4 (logand 4 (cdr (assoc 70 (tblsearch "layer" (getvar 'clayer))))))
           (prompt "\nCurrent layer locked.")
       )
       (   (or (tblsearch "block" (setq blk bse)) (setq blk (findfile (strcat pth bse ext))))
           (LM:AutoBlockBreak
               (vlax-vla-object->ename
                   (vla-insertblock
                       (vlax-get-property (LM:acdoc) (if (= 1 (getvar 'cvport)) 'paperspace 'modelspace))
                       (vlax-3D-point (trans ins 1 0))
                       blk
                       1.0
                       1.0
                       1.0
                       0.0
                   )
               )
               (= "ON" (getenv "LMac\\ABBRotation"))
           )
       )
       (   (prompt "\nBlock not found."))
   )
   (princ)
)

Then, in your Script, call the above function with the name/filename/filepath of the block to be inserted, and the block insertion point, e.g.:

(abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" '(1.0 2.0 0.0))

Posted

hi lee

 

I use your lisp ABBS at all my project and it's incredible.

So i've create a lisp that select block by polyline and i want to add the automatic rotation like your ABBS, but your prog is too difficult for me, can you explain me the automatic rotation?

 

thanks a lot for your job

Posted
I use your lisp ABBS at all my project and it's incredible.

So i've create a lisp that select block by polyline and i want to add the automatic rotation like your ABBS, but your prog is too difficult for me, can you explain me the automatic rotation?

 

thanks a lot for your job

 

Hi Francois,

 

I'm delighted that you find my AutoBlockBreak program so useful in your work!

 

Regarding the automatic block rotation, the rotation is calculated and set on lines 361-376 (inclusive) of the code - here, variable 'ent' is the block reference entity, and variable 'crv' is the curve entity (line/arc/circle/polyline/spline etc.) to which the block should be aligned.

 

Lee

Posted (edited)

Lee, man you are God like... is there a bar near your place, i want to order a case of beer for you dude.

however, i cant seem to make it work.

please teach me on where to insert the

(abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" '(1.0 2.0 0.0))

 

--------

 

 

got it Lord Lee.

 

many thanks from me & my staff.. cheers

Edited by ttray33y
Posted
Lee, man you are God like... is there a bar near your place, i want to order a case of beer for you dude.

 

Cheers ttray, you're too kind :)

 

however, i cant seem to make it work.

please teach me on where to insert the

(abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" '(1.0 2.0 0.0))

 

After you have copied the abb function definition (the larger code portion) to the AutoBlockBreak LISP file, the single line to call the function should go in your Script file, e.g. the Script would be something like:

 

_.open
C:/YourDrawing.dwg
(load "AutoBlockBreakV1-6.lsp" nil)
(if abb (abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" '(1.0 2.0 0.0)))
_.qsave
_.close

 

Lee

Posted

how about

(if abb (abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" '[b][color=red](1.0 2.0 0.0)[/color][/b]))

to replace the insertion point with getpoint :D

Posted
Sorry, I'm not sure that I quite understand your question?

 

hi Lee, sorry i forgot to update you, i already fix that, however i have 1 more prob regarding ABB. When inserting block in a polyline with Globalwidth the auto rotate function cant seem to recognize the polyline.

 

Capture1a.PNG

 

Capture2a.PNG

 

notice the Global width of the 2 polylines and the valve symbol on the PL with GW.

Note: rotation is ON

Capture1.PNG

Capture2.PNG

Posted
When inserting block in a polyline with Globalwidth the auto rotate function cant seem to recognize the polyline.

 

Thank you for bringing this to my attention, I have now updated the program to V1.7 to hopefully fix this issue.

 

Please try the new version available here. :)

 

Lee

Posted
Thank you for bringing this to my attention, I have now updated the program to V1.7 to hopefully fix this issue.

 

Please try the new version available here. :)

 

Lee

 

Lee, its wokring!.

 

many thanks from phils.

Posted
Lee, its wokring!.

 

many thanks from phils.

 

Excellent to hear! :)

 

You're most welcome.

  • 5 months later...
Posted
Excellent to hear! :)

 

You're most welcome.

 

(if abb (abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" '(1.0 2.0 0.0)))

 

in (1.0 2.0 0.0) is there any alternative where i can somewhat choose where i want to it insert it, like PAUSE.

 

TIA

Posted
(if abb (abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" '(1.0 2.0 0.0)))

in (1.0 2.0 0.0) is there any alternative where i can somewhat choose where i want to it insert it, like PAUSE.

 

You could use:

((lambda ( / ins ) (if (and abb (setq ins (getpoint "\nSpecify insertion point: "))) (abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" ins))))

Posted
You could use:

((lambda ( / ins ) (if (and abb (setq ins (getpoint "\nSpecify insertion point: "))) (abb "E:/250M_E_TOOLS/BLOCKS/VAL_BALL.dwg" ins))))

 

Lee, its perfect.

 

thanks!

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