Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/19/2021 in all areas

  1. Of course is doesn't. Read what I've written below. So it can't be made like it was before, that object was fliped based to clicked point, because You do "selection set". If You wan't select another (extra) point for rotation of all objects it is simple. You can do it Yourself if You just want to.
    1 point
  2. Might be simple just to type 'Arc' in the command line and follow it through from there to give you a clue. "f" is a character entered, so not a variable calculated earlier in the routine, but... in my 2020 AutoCAD the only options are "C" "E" or a point. It might be a hangover from an earlier version of the command, or a typing error? I guess you are asking because the routine isn't giving you the results you want? try changing it to an E and see what happens. An alternative might be to replace the "f" with pause as you check, run the LISP again and see what options come up when it gets to that point and pauses for your input... and that will give you a clue also as to what to change it to
    1 point
  3. It's in quotes so its not a variable. When i type the arc command in BricsCAD Enter start of arc or [Center/Follow]: Enter second point or [Angle/Center/Direction/End/Radius]: Follow Continues the arc tangent from the last point picked (same as pressing Enter).
    1 point
  4. I should have thought about that, we typically do that, add a few percent on and then round up to the nearest whole number for cable lengths. So 2 ways to do this, if you can find the line length from my 'linelengths' variable (setq linelengths (tlen))) You can change it to (setq linelengths (+ (tlen) 10)) You might want to replace the '10' by a variable (defined earlier in the code) for when you come back to this in a few years time and wonder how it all works again. Similarly you can add other mathmatical functions to this for example (setq linelengths (* (+ (tlen) 0) 1.1) ) to give you a 10% increase The other part you can update instead is from what BigAl suggested (setq drop (* totcurrent (* res (/ (* dist 2.0) 1000.0)))) and do a similar change to 'dist': (setq drop (* totcurrent (* res (/ (* (+ dist 10) 2.0) 1000.0))))
    1 point
  5. Seems like a simple regen issue. Notice that the main function is not a command ('C:') function. I have renamed the main function and added an example of a command function: ; Blk can be a block name or the ename of a "BLOCK" entity. (defun KGA_BlockClassic_EffectiveName (blk / elst blkRecHnd) (setq elst (entget (if (= 'ename (type blk)) blk (tblobjname "block" blk))) ) (if (and (= "*" (substr (cdr (assoc 2 elst)) 1 1)) (setq blkRecHnd (cdr (assoc 1005 (cdadr (assoc -3 (entget (cdr (assoc 330 elst)) '("AcDbBlockRepBTag"))))))) ) (cdr (assoc 2 (entget (handent blkRecHnd)))) (cdr (assoc 2 elst)) ) ) ; (ChangeDynBlockColor (vla-get-name (vlax-ename->vla-object (car (entsel)))) (acad_colordlg 2)) (defun ChangeDynBlockColor (nme col / N_Mod blks i nmeLst) (defun N_Mod (blk) (vlax-for obj blk (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (not (vl-position (strcase (vla-get-effectivename obj)) nmeLst)) ) (setq nmeLst (append nmeLst (list (strcase (vla-get-effectivename obj))))) ; Append required. (vla-put-color obj col) ) ) ) (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) (setq nmeLst (list (strcase (KGA_BlockClassic_EffectiveName nme)))) (setq i 0) (while (< i (length nmeLst)) (setq nme (nth i nmeLst)) (vlax-for blk blks (if (= nme (strcase (KGA_BlockClassic_EffectiveName (vla-get-name blk)))) (N_Mod blk) ) ) (setq i (1+ i)) ) ) (defun c:Test ( / col doc enm obj) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-endundomark doc) (vla-startundomark doc) (if (and (setq enm (car (entsel))) (setq obj (vlax-ename->vla-object enm)) (= "AcDbBlockReference" (vla-get-objectname obj)) (setq col (acad_colordlg 2)) ) (progn (ChangeDynBlockColor (vla-get-name obj) col) (vla-regen doc acactiveviewport) ) ) (vla-endundomark doc) (princ) )
    1 point
  6. Strange that a block definition does not have an EffectiveName property. But with some 'classic' Lisp you can create a workaround. I also tried to fix some issues with the recursion. ; Blk can be a block name or the ename of a "BLOCK" entity. (defun KGA_BlockClassic_EffectiveName (blk / elst blkRecHnd) (setq elst (entget (if (= 'ename (type blk)) blk (tblobjname "block" blk))) ) (if (and (= "*" (substr (cdr (assoc 2 elst)) 1 1)) (setq blkRecHnd (cdr (assoc 1005 (cdadr (assoc -3 (entget (cdr (assoc 330 elst)) '("AcDbBlockRepBTag"))))))) ) (cdr (assoc 2 (entget (handent blkRecHnd)))) (cdr (assoc 2 elst)) ) ) ; (colorb (vla-get-name (vlax-ename->vla-object (car (entsel)))) (acad_colordlg 2)) (defun colorb (nme col / N_Mod blks i nmeLst) (defun N_Mod (blk) (vlax-for obj blk (if (and (= "AcDbBlockReference" (vla-get-objectname obj)) (not (vl-position (strcase (vla-get-effectivename obj)) nmeLst)) ) (setq nmeLst (append nmeLst (list (strcase (vla-get-effectivename obj))))) ; Append required. (vla-put-color obj col) ) ) ) (setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))) (setq nmeLst (list (strcase (KGA_BlockClassic_EffectiveName nme)))) (setq i 0) (while (< i (length nmeLst)) (setq nme (nth i nmeLst)) (vlax-for blk blks (if (= nme (strcase (KGA_BlockClassic_EffectiveName (vla-get-name blk)))) (N_Mod blk) ) ) (setq i (1+ i)) ) )
    1 point
×
×
  • Create New...