Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/03/2021 in all areas

  1. See if this suits you. Basically, the function finds the projection point on the 3dface entity, starting from a point located on the same x and y coordinates. ;;; Syntax: ;;; (pointxface P1 fent) ;;; ;;; Arguments: ;;; P1 - point on Z=0 ;;; fent - entity 3dFace ;;; ;;; Retval: ;;; projection point on 3dface, if the projection of the point is outside the 3dface, the result will be nil (defun pointxface (P1 fent / vertice1 vertice2 vertice3 V1 V2 V3 D1 D2 D aa bb somma zeta puntoinalto) (setq vertice1 (cdr (assoc 10 (entget fent))) vertice2 (cdr (assoc 11 (entget fent))) vertice3 (cdr (assoc 12 (entget fent))) V1 (list (car vertice1)(cadr vertice1)) V2 (list (car vertice2)(cadr vertice2)) V3 (list (car vertice3)(cadr vertice3)) ) (setq D1 (- (* (- (car P1) (car V1)) (- (cadr V3) (cadr V1))) (* (- (cadr P1) (cadr V1)) (- (car V3) (car V1))) ) ) (setq D2 (- (* (- (car V1) (car P1)) (- (cadr V2) (cadr V1))) (* (- (cadr V1) (cadr P1)) (- (car V2) (car V1))) ) ) (setq D (- (* (- (car V2) (car V1)) (- (cadr V3) (cadr V1))) (* (- (cadr V2) (cadr V1)) (- (car V3) (car V1))) ) ) (setq aa (/ D1 D)) (setq bb (/ D2 D)) (setq somma (+ aa bb)) (if (equal aa 0.00 0.000001)(setq aa 0.0)) (if (equal bb 0.00 0.000001)(setq bb 0.0)) (if (equal somma 1.0 0.000001)(setq somma 1.0)) (if (and (>= aa 0.0) (>= bb 0.0)(<= somma 1.0)) ;;; Se aa>=0 and bb>=0 and aa+bb<=1 allora P è interno al triangolo o sul bordo. Altrimenti è esterno (progn (setq zeta (/ (+ (- (- (* (- (car P1) (car vertice1)) (- (* (- (cadr vertice2) (cadr vertice1)) (- (caddr vertice3) (caddr vertice1)) ) (* (- (cadr vertice3) (cadr vertice1)) (- (caddr vertice2) (caddr vertice1)) ) ) ) (* (- (cadr P1) (cadr vertice1)) (- (* (- (car vertice2) (car vertice1)) (- (caddr vertice3) (caddr vertice1)) ) (* (- (car vertice3) (car vertice1)) (- (caddr vertice2) (caddr vertice1)) ) ) ) ) ) (* (caddr vertice1) (- (* (- (car vertice2) (car vertice1)) (- (cadr vertice3) (cadr vertice1)) ) (* (- (car vertice3) (car vertice1)) (- (cadr vertice2) (cadr vertice1)) ) ) ) ) (- (* (- (car vertice2) (car vertice1)) (- (cadr vertice3) (cadr vertice1)) ) (* (- (car vertice3) (car vertice1)) (- (cadr vertice2) (cadr vertice1)) ) ) ) puntoinalto (list (car P1) (cadr P1) zeta) ) ) (setq puntoinalto nil) ) (princ "\n") puntoinalto )
    2 points
  2. 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
  3. Steven P no (10 188.0 62.0) for a plain pline. (38 . 12.0) which is elevation. A quicky for you in my autoload.lsp, I use these all the time for a quick look at object (defun c:ent ()(entget (car (entsel "Pick")))) or use Dumpit.lsp (100 . "AcDb3dPolyline") (10 0.0 0.0 0.0) get the vertex points. Use VL get coordinates. z= 233 etc Coordinates = (299493.688604032 1222965.59330423 233.721 299493.846604032 1222983.26930423 233.556 299493.916604032 1222989.04330423 233.542 299494.158604032 1222999.75930423 233.394 299494.923604032 1223015.36330423 233.192 299494.923425952 1223016.30612341 233.192 299494.868604032 1223016.74930423 233.191 299494.312604032 1223019.20230423 233.166 299494.396604032 1223024.37930423 233.085 299494.400604032 1223024.88130423 233.055 299495.208062272 1223037.39590885 232.937)
    1 point
×
×
  • Create New...