Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/24/2019 in all areas

  1. Not sure what happened but lost code from here. Will redo again. Please note the CMDactive crashes Briscad. Will look into it. ; reduce polygon facets by AlanH OCT 2019 (defun c:polred ( / x R lst co-ord plent) (setq plent (entsel "pick polygon")) (if plent (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent)))))) (setq R (getint "Enter reduction factor 2 3 4 etc")) (setq x 0) (setq lst '()) (setq lst (cons (nth x co-ord) lst)) (repeat (- (/ (length co-ord) R) 1) (setq lst (cons (nth (setq x (+ x R)) co-ord) lst)) ) (setvar 'clayer "0") ; add your layer or else erase plent ;(command "erase" plent "") (command "_pline") (while (= (getvar "cmdactive") 1 ) (repeat (setq x (length lst)) (command (nth (setq x (- x 1)) lst)) ) (command "C") ) ) (c:polred)
    1 point
  2. If your file contains a geolocation marker it should allow you to see the geolocation tab in the Ribbon. Otherwise you can add a marker, using online maps and choose your coordinate system using 'setlocation' from the insert tab of the ribbon.
    1 point
  3. I keep having this same question. From what you're asking I don't know how far that point must be from the block. Look at this code, made for the dwg attachment. I have different blocks, with different rotations, and a rectangle. My code puts a point on the rectangle. It also puts a point along that same line at a distance 25 (Assuming your image has a text height of 2.5, those points you want are at that distance) Command BFP (defun drawPoint (pt) (entmakex (list (cons 0 "POINT") (cons 10 pt))) ) (defun drawLine (p1 p2) (entmakex (list (cons 0 "LINE") (cons 10 p1) (cons 11 p2))) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Intersections - Lee Mac ;; Returns a list of all points of intersection between two objects ;; for the given intersection mode. ;; ob1,ob2 - [vla] VLA-Objects ;; mod - [int] acextendoption enum of intersectwith method ;; acextendnone Do not extend either object ;; acextendthisentity Extend obj1 to meet obj2 ;; acextendotherentity Extend obj2 to meet obj1 ;; acextendboth Extend both objects (defun LM:intersections ( ob1 ob2 mod / lst rtn ) (if (and (vlax-method-applicable-p ob1 'intersectwith) (vlax-method-applicable-p ob2 'intersectwith) (setq lst (vlax-invoke ob1 'intersectwith ob2 mod)) ) (repeat (/ (length lst) 3) (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn) lst (cdddr lst) ) ) ) (reverse rtn) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (defun c:bfp ( / rect blocks i l p1 rot p2 p3) (princ "\nSelect blocks: ") (setq blocks (ssget (list (cons 0 "INSERT")))) (setq rect (car (entsel "\nSelect rectangle: "))) ;; I'll extend a line to at least outside the rectangle. Using the length of the rectangle guarantees this (setq len (vla-get-length (vlax-ename->vla-object rect))) (setq i 0) (repeat (sslength blocks) ;; make a dummy line, we'll erase it later (setq l (drawLine (setq p1 (cdr (assoc 10 (entget (ssname blocks i))))) (polar p1 (setq rot (cdr (assoc 50 (entget (ssname blocks i))))) len) )) ;; find intersect with rectangle (setq p2 (nth 0 (LM:intersections (vlax-ename->vla-object l) (vlax-ename->vla-object rect) acextendnone))) (drawPoint p2) (setq p3 (vlax-curve-getPointAtDist (vlax-ename->vla-object l) 25.0)) (drawPoint p3) ;; delete the line (entdel l) (setq i (+ i 1)) ) ) Please try to explain again what exactly you need. block_rect.dwg
    1 point
×
×
  • Create New...