Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/01/2021 in all areas

  1. mhupp, Just for your better usage of first example, consider adding t argument here : (vlax-Dump-Object (vlax-Ename->Vla-Object ent) t) It will show methods supported by VLA-OBJECT besides all available properties... It can be useful...
    2 points
  2. Fist off Welcome to the forums. Depends on what you prefer. Even tho I have programmed in VBA for excel i stick to autolisp and Visual lisp for CAD. 1. not many people code in VBA macros so getting help might be a problem. 2. most people code in in lisp or vlisp for CAD. & i think its a little more intuitive. 3. vlisp and autolisp can be used at the same time. cant mix vba and lisp code. Here are some websites I recommend. http://www.lee-mac.com/tutorials.html https://www.afralisp.net/ https://jtbworld.com/autolisp-visual-lisp http://www.cadtutor.net/tutorials/autolisp/quick-start.php? Here are a few lisp to help out. these dump all the visual lisp and dxf properties of selected objects. ;;----------------------------------------------------------------------------;; ;; Dump All Visual lisp properties for selected objects (defun C:VDumpit (/ SS ent) (vl-load-com) (if (setq SS (ssget)) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (vlax-Dump-Object (vlax-Ename->Vla-Object ent) t) ) ) (textscr) (princ) ) ;;----------------------------------------------------------------------------;; ;; Dump all DXF Group Data (defun c:DumpIt (/ SS ent) (if (setq SS (ssget)) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS))) (mapcar 'print (entget ent '( "*"))) ) ) (textscr) (princ) )
    1 point
  3. Give this version a try: (defun c:foo (/ _aap a d l lines p p2 ss text x) ;; RJP » 2021-10-06 (defun _aap (ename pt / param) (if (and (not (vl-catch-all-error-p (vl-catch-all-apply 'vlax-curve-getendparam (list ename)))) (setq param (vlax-curve-getparamatpoint ename pt)) ) (angle '(0 0) (vlax-curve-getfirstderiv ename param)) ) ) (if (setq ss (ssget '((0 . "*polyline,Line,*Text")))) (progn (or (setq d (getdist "\nEnter offset distance:<0> ")) (setq d 0)) (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (if (wcmatch (cdr (assoc 0 (entget x))) "*TEXT") (setq text (cons x text)) (setq lines (cons x lines)) ) ) (if lines (foreach x text (setq p (cdr (assoc 10 (entget x)))) (setq l (mapcar '(lambda (x) (list (setq p2 (vlax-curve-getclosestpointto x p)) (distance p p2) (_aap x p2)) ) lines ) ) (setq l (car (vl-sort l '(lambda (a b) (< (cadr a) (cadr b)))))) ;; Check that we have an angle assigned (if (caddr l) (progn (entmod (subst (cons 50 ((lambda (x) (setq a (if (<= (* 0.5 pi) x (* 1.5 pi)) (+ x pi) x ) ) ) (caddr l) ) ) (assoc 50 (entget x)) (entget x) ) ) ) ) ; <--- Modified by Jonathan Handojo ;; RJP added offset (entmod (subst (cons 10 (polar (car l) (+ (/ pi 2) a) d)) (assoc 10 (entget x)) (entget x)) ) ; <--- Line added by Jonathan Handojo ) ) ) ) (princ) )
    1 point
×
×
  • Create New...