Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/17/2020 in all areas

  1. Hi guys, As thanks for helping me out through the journey of AutoLISP from multiple posts, I've decided to make a small contribution to CADTutor.net with my own code that you can download from here: https://www.cadtutor.net/forum/files/file/27-block-overkill/ Upon issuing the BOVERKILL command, This LISP will allow you to either delete blocks that area "duplicated" on top of one another, or move them to a specified layer. This LISP deletes blocks in which the blocks in comparison abides to the following three criteria below: It shares the same insertion point to a specified tolerance It shares the same effective name It shares the same effective scale to the same specified tolerance Modes of Overkill Thanks to a wonderful suggestion from one of the insights in this forum, the program has been further upgraded as of 20 April 2023. This LISP routine now also allows for three modes of overkill: Distance Plane-Axis Axes The "Distance" mode is the default mode and is the most widely used mode of overkill. This mode determines that two blocks are considered duplicates if the distance between them is within the specified tolerance inputted by the user. The "Plane-Axis" mode determines that two blocks are duplicates if the proximity of the blocks in comparison lies within one tolerance specified for one of the planes , and a separate tolerance along the third axis (normal) of that plane. Calculations are done to the UCS. The "Axes" mode determines that two blocks are duplicates by comparing three different tolerances across each axis individually. All three tolerances must be met for the program to consider the blocks a duplicate. Just like the previous mode, the UCS will be used by the program to perform the calculations. Following this, the program will also draw a circle (of a radius set within the LISP routine) on the insertion points of the processed blocks. These circles will be drawn in the "BOVERKILL-Duplicates" layer. After which it prints a report of the quantity of the deleted or modified blocks to the command line. This feature makes it easy for users to identify where duplicates are found on a large drawing with thousands of blocks. However, the dynamic properties of the block are far too hard for me to calculate as they have different position, rotation and visibility parameters that could be altered by the user. As such, they are ignored. Note that the rotation of the block does not fall in the criteria above as mirroring the block alters it's rotation values, and thus will fail on some circumstances. This means that the blocks will still be processed if as long as the three criteria above satisfy and objects are not rotated the same way. This LISP was inspired when using block counting routines (for example from Lee Mac's Block Counter routine or your own custom routines) reporting incorrect numbers due to duplicate blocks. The OVERKILL command for one reason or another is not able to delete duplicate dynamic blocks that are (for example, rotated normally then rotate through dynamic rotation to the original position). I've also cycled through the net for solutions to no avail. Thus, I opened this program for you folks to use. It's not a perfect code but I hope it will make working for you much more convenient. Any feedbacks, comments, and criticisms are welcomed as I look to learn and get better. Enjoy. Thanks, Jonathan Handojo
    1 point
  2. Version 1.3

    3,508 downloads

    Here I give you guys a program that will either delete duplicate blocks or move them to a user-input layer that could be accidentally placed on top of another. The determination to do such program in place of the OVERKILL command is to remove unwanted dynamic blocks with different visibility parameters, leading to blocks having an "undefined name". This leads to the original OVERKILL command to fail. As such, I introduce you this program that catches all types of blocks (excluding xrefs). Be careful that it delete blocks matching all the criteria below: The blocks in comparison share the same insertion point through a given tolerance. The blocks in comparison share the same effective name. The blocks in comparison share the same effective scale. So if the three criteria above match while the rotation of the blocks differ, it will still be deleted. I've had many occasion on using block counting routines that reports excessive values for this very reason. This routine has helped me fix those nasty errors that would otherwise be almost, if not entirely, impossible to detect with the human eye. As thanks for helping me solve many problems that I've posted in the LISP forum, this is the least I can offer, so I hope it's of some use. More details on this forum. Type BOVERKILL to start command. I welcome all suggestion, feedbacks, comments, and criticisms you have. Feel free to add your ideas, and I will try to improve them. Enjoy.
    1 point
  3. Hint: integers in AutoLISP are represented using signed 32-bit integers, unsigned integers aren't available.
    1 point
  4. All of these files worked for me. Note that the contour file works because it is a series of linear moves instead of zy/zx arcs I did notice that I didn't include the vl-load-com command in the lisp. If anyone has problems, this might be the cause. 3X_CONTOUR_TEST.nc CIM_POCKET.nc HSM.nc LISP_GEN_TEST.CAM
    1 point
  5. Have you had a look at Lee's Attribute Functions link? You can use those. Or here's one without his reference (although it looks very similar in nature) (defun c:blkhandler ( / adoc atts hand i mast ss tag vlent) (defun *error* (msg) (vla-EndUndoMark adoc) (princ (strcat "\nError: " msg))) (setq tag "ins_no" ; <--- Tag attribute in block adoc (vla-get-ActiveDocument (vlax-get-acad-object)) ) (vla-StartUndoMark adoc) (while (null (and (setq mast (car (entsel "\nSelect master block: "))) (eq (cdr (assoc 0 (entget mast))) "INSERT") ) ) (princ "\nInvalid selection") ) (setq hand (cdr (assoc 5 (entget mast))) tag (strcase tag) ) (if (setq ss (ssget '((0 . "INSERT")))) (repeat (setq i (sslength ss)) (and (vlax-write-enabled-p (setq vlent (vlax-ename->vla-object (ssname ss (setq i (1- i)))))) (setq atts (vlax-invoke vlent 'GetAttributes)) (vl-some '(lambda (y) (if (eq (vla-get-TagString y) tag) (vla-put-TextString y hand))) atts) ) ) ) (vla-EndUndoMark adoc) (princ) )
    1 point
  6. For AutoLISP I use the VLIDE, for C#/VB .NET I use Visual Studio, for everything else I use Notepad++.
    1 point
  7. You're welcome Patrick. Good suggestion. I've modified the program to do as requested.
    1 point
×
×
  • Create New...