Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/02/2023 in all areas

  1. Try this: (defun c:calcVR(/ sum sumCubic ss i dim m) (setq sum 0 sumCubic 0 ) (setq ss (ssget '((0 . "DIMENSION")))) (repeat (setq i (sslength ss)) (setq dim (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (if (/= (vlax-get dim 'textOverride) "") (setq m (atof (vlax-get dim 'textOverride))) (setq m (atof (rtos (vlax-get dim 'measurement) 2 (vlax-get dim 'TolerancePrecision)))) ) (setq sum (+ sum m) sumCubic (+ sumCubic (expt m 3)) ) ) (alert (strcat "Vão regulador: " (rtos (sqrt (/ sumCubic sum)) 2 0))) (princ) )
    1 point
  2. There is a new BREAKATPOINT command that does this. I made an alias of BAP for it
    1 point
  3. Tried to post yesterday look at Lee-mac pick cell in table allows selection of a cell by picking the value displayed. ;; Example shows how to pick a single table cell on screen and change its value. ;; This example demonstrates the ActiveX properties/methods HitTest, ;; GetCellType, GetText and SetText. ; original code by Lee Ambrosius 2015 (defun c:SelectTableCell ( / pick vHeight vWidth lwrLeft uprRight vector SS_TABLES cnt eMax tableObj row col cellValueOrg) ;; Ask the user for a point on screen (if (/= (setq pick (vlax-3d-point (getpoint "\nSelect Cell to edit: "))) nil) (progn ;; Get the corners of the screen display to build our selection set (setq vHeight (getvar "viewsize")) (setq vWidth (* (/ (nth 0 (getvar "screensize")) (nth 1 (getvar "screensize"))) vHeight)) (setq lwrLeft (list (- (nth 0 (getvar "viewctr")) (/ vWidth 2)) (- (nth 1 (getvar "viewctr")) (/ vHeight 2)) 0)) (setq uprRight (list (+ (nth 0 (getvar "viewctr")) (/ vWidth 2)) (+ (nth 1 (getvar "viewctr")) (/ vHeight 2)) 0)) ;; Get the current display orientation (setq vector (vlax-make-safearray vlax-vbDouble '(0 . 2))) (vlax-safearray-fill vector '(1 1 1)) (setq vector (vlax-make-variant vector)) ;; Select all the table objects visible on screen (if (setq SS_TABLES (ssget "C" lwrleft uprright (list (cons 0 "ACAD_TABLE")))) (progn (setq cnt 0 eMax (sslength SS_TABLES) ) ;; Step through all the items in the selection set (while (> eMax cnt) ;; Geta table object from the selection set (setq tableObj (vlax-ename->vla-object (ssname SS_TABLES cnt))) ;; Return values for what cell was picked in (setq row 0 col 0) ;; Check to see if a valid cell was picked (if (= (vla-hittest tableObj pick vector 'row 'col) :vlax-true) (progn ;; Get out of the loop (setq cnt (1+ eMax)) ;; Check to see what the Cell Type is (Text or Block) (if (= (vla-GetCellType tableObj row col) acTextCell) (progn ;; Let's get the value out (setq cellValueOrg (vla-GetText tableObj row col)) ;; Change the current value (vla-SetText tableObj row col "Revised Text") (vla-Update tableObj) (alert "Cell text was changed.") ;; Restore the original value (vla-SetText tableObj row col cellValueOrg) (vla-Update tableObj) (alert "Cell text was changed back to the original value.") (setq cnt eMax) ) ) ) ) (setq cnt (1+ cnt)) ) ) ) ) ) (princ) )
    1 point
  4. Hola Toni . por favor sube tu DWG . Hi Toni , please upload your DWG. Lisp can do any mathematical formula as it have this functions 1 Mathematics + --------- Add - --------- Subtract * --------- Multiply / --------- Divide rem ------- Remainder of integer division 1+ -------- Increment by one 1- -------- Decrement by one abs ------- Absolute fix ------- Truncates a real to an integer float ----- Converts an integer to a real gcd ------- Greatest common denominator min ------- Smallest (least) of group max ------- Largest (greatest) of group sqrt ------ Square root expt ------ Exponent exp ------- Power of e log ------- Natural log cvunit ---- Converts a value from one unit to another 2 Geometry & trigonometry distance -- Returns distance between two points angle ----- Returns angle between two points polar ----- Returns a point at a given distance and angle from a base point inters ---- Returns point at which two lines intersect sin ------- Sine cos ------- Cosine atan ------ Arctangent
    1 point
  5. The dimension variables are massive finding a list with explanations is difficult. This is not bad some may not be correct forget where I found it (cons 0 "DIMSTYLE") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbDimStyleTableRecord") (cons 2 Dim_Name) ;Dim style name (cons 70 0) ; Standard flag (cons 3 " [m]"); DIMPOST (cons 4 ""); DIMAPOST (cons 5 DIMBLK-Name) ;DIMBLK-Name of block instead of default arrowhead (cons 6 DIMBLK-Name);(cons 6 "ClosedFilled"); DIMBLK1 (cons 7 "");(cons 7 DIMBLK-Name); DIMBLK2 (cons 170 0) ;DIMALT-turns off alternate units (cons 40 dimscale) ;DIMSCALE-sets the overall scale factor applied to all dimensions (cons 41 Arrow_Size) ;DIMASZ-sets the size of the arrow/tick (cons 42 Extension_Line_Origin_Offset); DIMEXO (cons 43 Dimension_Line_Spacing); DIMDLI (cons 44 Extension_Above_Dimension_Line) ;DIMEXE-specifies how far to extend the extention line beyound the dim line (cons 45 0.0); DIMRND (cons 46 0) ;DIMDLE-sets the distance the dimension line extends beyond the extension line (cons 47 0.0); DIMTP (cons 48 0.0); DIMTM (cons 71 0); DIMTOL (cons 72 0); DIMLIM (cons 73 0) ;DIMTIH-controls the position of dimension text inside extention lines ;METTE IL TESTO DI QUOTA ORIZZONTALE (cons 74 0) ;DIMTOH-controls the position of dimension text outside extention lines (cons 75 1); DIMSE1 ;1 sopprime la linea di estensione, 0 la lascia (cons 76 1); DIMSE2 ;1 sopprime la linea di estensione, 0 la lascia (cons 77 1) ;DIMTAD-controls the vertical position of text in relation to the dim line (cons 78 3) ;DIMZIN-controls the suppression of zeros (cons 79 1); DIMAZIN (cons 140 Text_Height) ;DIMTXT-specifies the height of the text in the dim (cons 141 Center_Mark_Size); DIMCEN (cons 142 0.0); DIMTSZ (cons 143 0.5) ;DIMALTF-controls the scale factor for alt. units (cons 144 quote_scale); DIMLFAC ;scala di quota (cons 145 0.0); DIMTVP (cons 146 0.64); DIMTFAC (cons 147 Gap_From_dimension_Line_to_Text) ;DIMGAP-sets the distance from around the dim text (cons 170 0); DIMALT (cons 171 2) ;DIMALTD-controls the decimal places for units (cons 172 0) ;DIMTOFL-forces a line inside extension lines (cons 173 1); DIMSAH (cons 174 0); DIMTIX (cons 175 0); DIMSOXD (cons 176 256); DIMCLRD (cons 177 256); DIMCLRE (cons 178 256); DIMCLRT color of text (cons 179 0); DIMADEC (cons 270 2) ;DIMUNIT-sets the units format for all dims ;2 decimale ; 4architettonico (cons 271 Decimal_Places) ;DIMDEC-sets the number of decimal places of primary units (cons 272 Tolerance_Decimal_places); DIMTDEC (cons 273 2) ;DIMALTU-sets the units for alt. units (cons 275 0) ;DIMAUNIT-sets the angular format for angular dims (cons 276 1); DIMFRAC (cons 277 2); DIMLUNIT ;2 decimale ; 4architettonico (cons 278 0); DIMDSEP (cons 279 Text_Movement); DIMTMOVE (cons 280 0) ;DIMJUST-controls the horizontal positioning of dim text (cons 281 -1); DIMSD1 (cons 282 -1); DIMSD2 (cons 283 1); DIMTOLJ (cons 284 3); DIMTZIN (cons 285 1); DIMALTZ (cons 286 0) ;DIMALTTZ-Toggles the suppression in tolerance values ;(cons 287 0); DIMFIT ;(cons 288 0); DIMUPT ;(cons 289 0); DIMATFIT (cons 340 (tblobjname "style" "Estilo_Cotas")); DIMTXSTY ;(cons 341 (cdr (assoc 330 (entget (tblobjname "block" "."))))); DIMLDRBLK ;(cons 342 (cdr (assoc 330 (entget(tblobjname "block" "_Oblique"))))); DIMBLK must setvar dimblk 1st ;(cons 343 (cdr (assoc 330 (entget(tblobjname "block" "_Oblique"))))); DIMBLK1 ;(cons 344 (cdr (assoc 330 (entget(tblobjname "block" "_Oblique"))))); DIMBLK2 ;(cons 371 -2); DIMLWD ;(cons 372 -2); DIMLWE Look at DIMCLRT maybe Google "DIMCLRT Autocad" go down a few suggestions look for the official Autodesk help.
    1 point
  6. (Can't sleep) Here's a way... You'll need this subroutine: http://www.cadtutor.net/forum/showpost.php?p=271368&postcount=13 ;;; Stored Selection Sets ;;; Required Subroutines: AT:ListSelect ;;; Alan J. Thompson, 03.26.10 (defun c:SSS (/ #Choice #Name #SS) (vl-load-com) (or *SSS:Option* (setq *SSS:Option* "Store")) (initget 0 "Recall rEmove Store") (if (vl-consp *SSS:Sets*) (setq *SSS:Option* (cond ((getkword (strcat "\nStore Selection Sets\nSpecify option. [Recall/rEmove/Store] <" *SSS:Option* ">: " ) ;_ strcat ) ;_ getkword ) (*SSS:Option*) ) ;_ cond ) ;_ setq (setq *SSS:Option* "Store") ) ;_ if (cond ((eq *SSS:Option* "Recall") (if (vl-consp *SSS:Sets*) (and (setq #Choice (car (AT:ListSelect "Recall Stored Selection Sets" "Select Selection Set:" "10" "10" "false" (vl-sort (mapcar 'car *SSS:Sets*) '<) ) ;_ AT:ListSelect ) ;_ car ) ;_ setq (if (vl-position (getvar 'cmdactive) '(1 2)) (and (setq SSS (cdr (assoc #Choice *SSS:Sets*))) (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))) (vla-sendcommand *AcadDoc* "!SSS ") ) ;_ and (sssetfirst nil (cdr (assoc #Choice *SSS:Sets*))) ) ;_ if ) ;_ and (alert "No selection sets stored!") ) ;_ if ) ((eq *SSS:Option* "rEmove") (if (vl-consp *SSS:Sets*) (and (setq #Choice (AT:ListSelect "Remove Stored Selection Sets" "Select Selection Set(s):" "10" "10" "true" (vl-sort (mapcar 'car *SSS:Sets*) '<) ) ;_ AT:ListSelect ) ;_ setq (progn (foreach x #Choice (setq *SSS:Sets* (vl-remove (assoc x *SSS:Sets*) *SSS:Sets*))) (print #Choice) (princ (strcat "\n" (itoa (length #Choice)) " stored selection set(s) removed.")) ) ;_ progn ) ;_ and (alert "No selection sets stored!") ) ;_ if ) ((eq *SSS:Option* "Store") (and (/= "" (setq #Name (strcase (getstring t (strcat (if (vl-consp *SSS:Sets*) (strcat "\nStored Selection Sets: " (vl-princ-to-string (vl-sort (mapcar 'car *SSS:Sets*) '<)) ) ;_ strcat "" ) ;_ if "\nSelection set name: " ) ;_ strcat ) ;_ getstring ) ;_ strcase ) ;_ setq ) ;_ /= (or (not (vl-position #Name (mapcar (function car) *SSS:Sets*))) (alert (strcat "Sorry, \"" #Name "\" is already a stored selection set.")) ) ;_ or (setq #SS (ssget)) (setq *SSS:Sets* (cons (cons #Name #SS) *SSS:Sets*)) (princ (strcat "Selection set \"" #Name "\" stored.")) ) ;_ and ) ) ;_ cond (princ) ) ;_ defun Here's something similar I did: http://www.cadtutor.net/forum/showthread.php?t=45215
    1 point
×
×
  • Create New...