Jump to content

Recommended Posts

Posted

I had a thought for a lisp and I'm wondering if maybe something like it already exists.  I draw mechanical assemblies with lots of mark bubbles, weld symbols, and other blocks.  Using weld symbols as an example: Is there a way to type a command  for the block (Weld), then select all the locations that I want to place a weld symbol, hit enter, and have it appear?  They're dynamic blocks so once they're in place I would be able to manipulate the weld type but it would eliminate having to insert blocks repeatedly or copying/pasting them.  Thanks for the help.

Posted

Post a sample drawing. Inserting blocks is quite easy with lisp. Next step is logic to determine what weld goes where.

Posted

Example attached.  Excuse the drafting quality, just grabbed something someone did from Vault.  Weld symbols are in Red.  The idea is type a command, select the points where you would want the blocks, in this case weld symbols, and then insert them at the selected points all at once.

sample.dwg

Posted (edited)

Give this a try. Inserts block 'weldunder' at midpoint of horizontal sections of leaders.

(defun c:foo (/ d p s sc)
  ;; RJP » 2019-05-22
  (cond	((null (tblobjname "block" "WELDUNDER")) (print "Block 'WELDUNDER' not found!"))
	((setq s (ssget '((0 . "leader"))))
	 (setq s (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))))
	 (setq d (vlax-ename->vla-object (cdr (assoc 330 (entget (car s))))))
	 (foreach e s
	   (setq p (mapcar 'cdr (vl-remove-if '(lambda (x) (/= 10 (car x))) (entget e))))
	   (mapcar '(lambda (r j)
		      (if (equal (cadr r) (cadr j) 1e-2)
			(vla-insertblock
			  d
			  (vlax-3d-point (mapcar '/ (mapcar '+ r j) '(2 2 2)))
			  "WELDUNDER"
			  (setq sc 2.7)
			  sc
			  sc
			  0
			)
		      )
		    )
		   p
		   (cdr p)
	   )
	 )
	)
  )
  (princ)
)
(vl-load-com)

 

Edited by ronjonp
Posted

Thanks for the help.  For one reason or another it's not recognizing the hatching when I select it.  I load the lisp, enter the command, and am prompted to select objects, I select the intended point of placement, and it's not recognizing it...even if I hit enter.  I tried generating boundaries around the hatching to give it a defined pick point but that's not doing the trick either.  Thoughts?  Thanks again.

Posted (edited)
1 hour ago, Jim Clayton said:

Thanks for the help.  For one reason or another it's not recognizing the hatching when I select it.  I load the lisp, enter the command, and am prompted to select objects, I select the intended point of placement, and it's not recognizing it...even if I hit enter.  I tried generating boundaries around the hatching to give it a defined pick point but that's not doing the trick either.  Thoughts?  Thanks again.

I misunderstood your intentions. The code above inserts this block at the midpoint of horizontal leader landings which I explained above in my post. 😉

image.png.7ebe1cd303e2ded223b2ea6bbde0d6d0.png

Edited by ronjonp
Posted

I think I'm looking for something like this, which might be a Lee Mac lisp...but maybe thinned down a bit, or with a search capability rather than entering the block name.  But honestly it's a bit of a guessing game right now.

 

pnt2blk.lsp

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