Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/13/2020 in all areas

  1. ; list? not quite. maybe you mean acTitikPertama inside ( ? ), the first symbol within brackets (symbol ... ) evaluated as function so it'll be executed. example: (ver) (acTitikPertama) (c:KK) (itoa 123) ; with argument just skip it whatever you name it main program, as long as you invoke SINGLE command like c:KK, then you get the job done. which sub routines maybe used MANY times during c:KK executing. (defun c:KK ( / sub1 sub2 sub3 )(defun sub1 ...) (defun sub2 ...) (defun sub3 ...) ; execution)
    1 point
  2. I would recommend you draw all the dimensions first (rotated or aligned), then upon executing the command, select all the dimensions, and AutoLISP will determine all common intersecting points. Here's my solution for you: ;; Get arrowhead location for the dimension --> Jonathan Handojo ;; dim - dimension entity ;; Returns a list of two points denoting the arrowhead location (defun JH:getarrowpt (dim / dimang pt1 pt2 pt3 pt4) (setq dimang (angle (setq pt1 (cdr (assoc 10 (entget dim)))) (setq pt2 (cdr (assoc 11 (entget dim)))) ) ) (list (inters pt1 pt2 (setq pt3 (cdr (assoc 13 (entget dim)))) (polar pt3 (+ (* 0.5 pi) dimang) 1) nil ) (inters pt1 pt2 (setq pt4 (cdr (assoc 14 (entget dim)))) (polar pt4 (+ (* 0.5 pi) dimang) 1) nil ) ) ) ;; Gets a list of duplicated points with a certain fuzz in a list of points ;; lst - list of points to check for ;; fuz - tolerance between points ;; Returns a list of duplicate points (defun JH:commonpts (lst fuz / tst rtn) (while lst (setq tst (car lst) lst (cdr lst) ) (if (and (vl-some '(lambda (x) (equal tst x fuz) ) lst ) (not (vl-some '(lambda (x) (equal tst x fuz) ) rtn ) ) ) (setq rtn (cons tst rtn)) ) ) (reverse rtn) ) ;; ------------------------------------------- ;; (defun JH:selset-to-list (selset / lst iter) ; Returns all entities within a selection set into a list. (setq iter 0) (repeat (sslength selset) (setq lst (cons (ssname selset iter) lst) iter (1+ iter)) ) (reverse lst) ) ;; ------------------------------------------- ;; (defun c:putblk ( / *error* activeundo acadobj adoc arrpt blk DegToRad fuz msp rot ss) (defun *error* ( msg ) (vla-EndUndoMark adoc) (if (not (wcmatch (strcase msg T) "*break*,*cancel*,*exit*")) (princ (strcat "Error: " msg)) ) ) (defun DegToRad (x) (* x (/ pi 180))) (setq acadobj (vlax-get-acad-object) adoc (vla-get-ActiveDocument acadobj) msp (vla-get-ModelSpace adoc) activeundo nil) (if (= 0 (logand 8 (getvar "UNDOCTL"))) (vla-StartUndoMark adoc) (setq activeundo T)) (setq ss (ssget '((0 . "DIMENSION"))) blk "Tem_Sense" ; <--- Block name to insert fuz 1e-4 ; <--- Intersection tolerance ) (if ss (progn (setq arrpt (apply 'append (mapcar 'JH:getarrowpt (JH:selset-to-list ss))) rot (progn (initget 1) (getreal "\nSpecify rotation in degrees: ")) ) (if (tblsearch "BLOCK" blk) (mapcar '(lambda (x) (vla-InsertBlock msp (apply 'vlax-3d-point x) blk 1 1 1 (DegToRad rot)) ) (JH:commonpts arrpt fuz) ) ) ) ) (if activeundo nil (vla-EndUndoMark adoc)) (princ) )
    1 point
  3. Thank you for your time. I'll try it out once i can figure out which is which. No, im not Indonesian im Malaysian. Close tho, neighbour.
    1 point
×
×
  • Create New...