Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/21/2023 in all areas

  1. So the result desired is a Latitude & Longitude, not X Y, there is various programs out there that will do that, the most important issue is that you have to set the world zone for where you are else the result will be pretty useless. Yes that is why this sort of thing is in CIV3D.
    1 point
  2. Thank you so much, pkenewell. He is perfect.
    1 point
  3. That is a problem inherent in the "BrowseForFolder" Method; whatever path you start with becomes the root, and you can't navigate above it. This requires the Express tools, but using the function (acet-ui-pickdir "Select a folder:" "C:\\Temp\\") does not have this issue.
    1 point
  4. When you look at GETATT or any other Vl posted you have 2 choices GET or PUT, its that simple. (setq str (vla-get-textstring att)) (vla-put-textstring att newstring) ; your number ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq str (vlax-get att 'textstring)) (vlax-put att 'Textstring newstring) ; your number Edit GETATT to suit.
    1 point
  5. ChatGPT was once explained to me that it is just a really clever predictive text algorithm, like on your phone messaging just a bit more advanced. It can't think for itself it just predicts the text to use. Similar to your phone you still have to compose what you want to say even if the phone fills in the blanks for the words to use.
    1 point
  6. FYI... ChatGBT does not do lisp well. it can sometimes get you close but I have found personally a 85% failure rate. It makes up functions. Sometimes it's funny what it calls them... Sometimes it fills enough gaps so that if you know lisp you can fill in the needed parts. I do hope it gets better...
    1 point
  7. Hi, I have a somewhat similar procedure, but it works with two polylines. Two solutions are drawn up in the end, you just have to keep one of your choice! I'm attaching your example drawing modified to work with my procedure. Does this sound interesting to you? (vl-load-com) (defun add_vtx (obj add_pt ent_name / bulg) (vla-addVertex obj (1+ (fix add_pt)) (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 0 1)) (list (car (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name)) (cadr (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name)) ) ) ) ) (setq bulg (vla-GetBulge obj (fix add_pt))) (vla-SetBulge obj (fix add_pt) (/ (sin (/ (* 4 (atan bulg) (- add_pt (fix add_pt))) 4)) (cos (/ (* 4 (atan bulg) (- add_pt (fix add_pt))) 4)) ) ) (vla-SetBulge obj (1+ (fix add_pt)) (/ (sin (/ (* 4 (atan bulg) (- (1+ (fix add_pt)) add_pt)) 4)) (cos (/ (* 4 (atan bulg) (- (1+ (fix add_pt)) add_pt)) 4)) ) ) (vla-update obj) ) (defun c:vertex_median ( / fst_ob snd_obj vrt_pt pt lst_pt fst_dxf snd_dxf lst1 lst2 lstx ptx) (princ "\nSelect first polyline: ") (while (not (setq fst_obj (ssget "_+.:E:S" '((0 . "LWPOLYLINE")))))) (princ "\nSelect second polyline: ") (while (not (setq snd_obj (ssget "_+.:E:S" '((0 . "LWPOLYLINE")))))) (setq fst_obj (ssname fst_obj 0) snd_obj (ssname snd_obj 0) vrt_pt (vlax-variant-value (vla-IntersectWith (vlax-ename->vla-object fst_obj) (vlax-ename->vla-object snd_obj) 0)) ) (if (>= (vlax-safearray-get-u-bound vrt_pt 1) 0) (progn (setq pt (vlax-safearray->list vrt_pt)) (if pt (if (> (length pt) 3) (repeat (/ (length pt) 3) (setq lst_pt (cons (list (car pt) (cadr pt) (caddr pt)) lst_pt) pt (cdddr pt)) ) (setq lst_pt (cons pt lst_pt)) ) ) ) ) (setq fst_dxf (entget fst_obj) snd_dxf (entget snd_obj) lst1 (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) fst_dxf)) lst2 (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) snd_dxf)) lstx nil ) (if (and lst_pt (listp lst_pt)) (progn (setq obj (vlax-ename->vla-object fst_obj)) (foreach el lst_pt (if (not (member T (mapcar '(lambda (x) (equal (list (car el) (cadr el)) x 1E-8)) lst1))) (add_vtx obj (vlax-curve-getparamatpoint obj (vlax-curve-getClosestPointTo obj el)) fst_obj) ) ) (setq obj (vlax-ename->vla-object snd_obj)) (foreach el lst_pt (if (not (member T (mapcar '(lambda (x) (equal (list (car el) (cadr el)) x 1E-8)) lst2))) (add_vtx obj (vlax-curve-getparamatpoint obj (vlax-curve-getClosestPointTo obj el)) snd_obj) ) ) ) ) (setq fst_dxf (entget fst_obj) snd_dxf (entget snd_obj) lst1 (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) fst_dxf)) lst2 (mapcar 'cdr (vl-remove-if '(lambda (x) (/= (car x) 10)) snd_dxf)) lstx nil ) (foreach n lst1 (setq pt (nth (vl-position (apply 'min (setq lst_d (mapcar '(lambda (x) (distance n x)) lst2))) lst_d) lst2) ptx (list (* 0.5 (+ (car n) (car pt))) (* 0.5 (+ (cadr n) (cadr pt)))) lstx (cons ptx lstx) ) ) (entmake (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (assoc 67 fst_dxf) (assoc 410 fst_dxf) (assoc 8 fst_dxf) (if (assoc 62 fst_dxf) (assoc 62 fst_dxf) (cons 62 256)) (if (assoc 6 fst_dxf) (assoc 6 fst_dxf) (cons 6 "BYLAYER")) (if (assoc 370 fst_dxf) (assoc 370 fst_dxf) (cons 370 -1)) (cons 100 "AcDbPolyline") (cons 90 (length lstx)) (assoc 70 fst_dxf) (if (assoc 38 fst_dxf) (assoc 38 fst_dxf) (cons 38 0.0)) (if (assoc 39 fst_dxf) (assoc 39 fst_dxf) (cons 39 0.0)) ) (apply 'append (mapcar '(lambda (x10) (list (cons 10 x10) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) ) ) lstx ) ) (list (assoc 210 fst_dxf)) ) ) (setq lstx nil) (foreach n lst2 (setq pt (nth (vl-position (apply 'min (setq lst_d (mapcar '(lambda (x) (distance n x)) lst1))) lst_d) lst1) ptx (list (* 0.5 (+ (car n) (car pt))) (* 0.5 (+ (cadr n) (cadr pt)))) lstx (cons ptx lstx) ) ) (entmake (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (assoc 67 snd_dxf) (assoc 410 snd_dxf) (assoc 8 snd_dxf) (if (assoc 62 snd_dxf) (assoc 62 snd_dxf) (cons 62 256)) (if (assoc 6 snd_dxf) (assoc 6 snd_dxf) (cons 6 "BYLAYER")) (if (assoc 370 snd_dxf) (assoc 370 snd_dxf) (cons 370 -1)) (cons 100 "AcDbPolyline") (cons 90 (length lstx)) (assoc 70 snd_dxf) (if (assoc 38 snd_dxf) (assoc 38 snd_dxf) (cons 38 0.0)) (if (assoc 39 snd_dxf) (assoc 39 snd_dxf) (cons 39 0.0)) ) (apply 'append (mapcar '(lambda (x10) (list (cons 10 x10) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) ) ) lstx ) ) (list (assoc 210 snd_dxf)) ) ) (sssetfirst nil (ssadd snd_obj (ssadd fst_obj (ssadd)))) (prin1) ) Test example.dwg
    1 point
  8. You could also do something like this: (will bomb if object inserted is on a locked layer, or the layer does not exist. *edit...use entmod so the layer will be automagically created if it does not exist. (setq rot (rtd (vla-get-rotation obj))) (setq xscale (vla-get-xscalefactor obj)) (setq yscale (vla-get-yscalefactor obj)) ;switch to kc layer (command "-insert" (nth count kclst) ipt xscale yscale rot) ;;(vla-put-layer (vlax-ename->vla-object (entlast)) "kc") (entmod (subst (cons 8 "kc") (assoc 8 (entget (entlast))) (entget (entlast)))) ;switch to mg layer (command "-insert" (nth count mglst) ipt xscale yscale rot) ;;(vla-put-layer (vlax-ename->vla-object (entlast)) "mg") (entmod (subst (cons 8 "mg") (assoc 8 (entget (entlast))) (entget (entlast)))) ;switch to wipeout layer (command "-insert" (nth count wipelst) ipt xscale yscale rot) ;;(vla-put-layer (vlax-ename->vla-object (entlast)) "wipeout") (entmod (subst (cons 8 "wipeout") (assoc 8 (entget (entlast))) (entget (entlast))))
    1 point
×
×
  • Create New...