Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/28/2022 in all areas

  1. Version 1.7.0

    3,315 downloads

    This program will calculate the total length of Lines/Polylines/LWPolylines/Arcs/Ellipses/Circles/Splines with an optional filter. The Filter may be used to select only those lines that are on a certain layer, or perhaps have a certain linetype or colour. The results of the calculation can be displayed in an ACAD Table within the drawing, or written to either a CSV or TXT File. The Table-Style may be selected from the drop-down in the main dialog. Main interface The main dialogue box allows the user to filter lines by layer, linetype or colour and select the table style. Multiple selected items can filtered. A filter string may be entered to help the user quickly find the filter items that he/she requires. Options The options dialogue box allows the user to specify which object types should be included and the type of output, table in the drawing, CSV file or TXT file. Demo Function Syntax: LenCal For instructions on how to run the program see here. Any comments, criticism and suggestions are welcome. Either PM me directly, or reply to the original thread.
    1 point
  2. A complex example Creates a shp file of the shape for a complex linetype Compile this file Creates the linetype .lin model Makes the linetype table Load this type of line into the current drawing Linetype is available in the drawing ((lambda ( / f_shp f_lin doc) (if (not (findfile "rond_plein.shp")) (progn (setq f_shp (open (strcat (getvar "ROAMABLEROOTPREFIX") "support\\rond_plein.shp") "w")) (write-line "*128,66,RONDPLEIN" f_shp) (write-line "2,3,10,010,1,10,(1,000),2,010,1,10,(2,000),2,010,1,10,(3,000),2,010,1,10," f_shp) (write-line "(4,000),2,010,1,10,(5,000),2,010,1,10,(6,000),2,010,1,10,(7,000),2,010,1,10," f_shp) (write-line "(8,000),2,010,1,10,(9,000),2,010,1,10,(10,000),2,3,10,0" f_shp) (close f_shp) ) ) (command "_.compile" (strcat (getvar "ROAMABLEROOTPREFIX") "support\\rond_plein.shp")) (if (not (tblsearch "STYLE" "")) (entmakex '( (0 . "STYLE") (100 . "AcDbSymbolTableRecord") (100 . "AcDbTextStyleTableRecord") (2 . "") (70 . 1) (40 . 0.0) (41 . 1.0) (50 . 0.0) (71 . 0) (42 . 2.5) (3 . "rond_plein.shx") (4 . "") ) ) ) (entmake (list '(0 . "LTYPE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLinetypeTableRecord") '(2 . "DotsLine") '(70 . 0) '(3 . "pointillé shx . . . .") '(72 . 65) '(73 . 2) '(40 . 1.0) '(49 . 1.0) '(74 . 4) '(75 . 128) (CONS 340 (TBLOBJNAME "STYLE" "")) '(46 . 0.1) '(50 . 0.0) '(44 . 0.0) '(45 . 0.0) '(49 . 0.0) '(74 . 0) ) ) (if (not (findfile "DotsLine.lin")) (progn (setq f_lin (open (strcat (getvar "ROAMABLEROOTPREFIX") "support\\DotsLine.lin") "w")) (write-line "*DotsLine,cloture shx . . . ." f_lin) (write-line "A,1,[RONDPLEIN,rond_plein.shx,x=0,s=.1],0" f_lin) (close f_lin) ) ) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (if (and (not (vlax-for item (vla-get-linetypes doc) (if (= (strcase (vla-get-name item)) (strcase "DotsLine")) T) ) ) (vl-catch-all-error-p (vl-catch-all-apply 'vla-load (list (vla-get-Linetypes doc) "DotsLine" "DotsLine.lin") ) ) ) nil T ) (princ "\nCréation de Type de Ligne \"DotsLine\" effectué!") (prin1) ))
    1 point
  3. Just tested mhupp's code and it looks like it's working just fine , well done mhupp
    1 point
  4. Using the title block instead of creating a viewport (defun c:Clean (/ ss tblk LL UR ss1 ss2) (command "_.Undo" "BE") (setvar 'cmdecho 0) (foreach lay (layoutlist) (setvar 'ctab lay) (command "_.Zoom" "E") (if (and (setq ss (ssget "_X" (list '(0 . "INSERT") '(2 . "GP1117_21" ) (cons 410 lay)))) (= (sslength ss) 1)) (progn (setq tblk (vlax-ename->vla-object (ssname ss 0))) (vla-GetBoundingBox tblk 'LL 'UR) (setq LL (vlax-safearray->list LL) UR (vlax-safearray->list UR) ) (if (and (setq ss1 (ssget "_A" (list (cons 410 lay)))) (setq ss2 (ssget "_W" LL UR (list (cons 410 lay))))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss2))) (ssdel ent ss1) ) ) (ssdel (ssname ss 0) ss1) (command "_.Erase" SS1 "") (command "_.Zoom" "E") ) ) ) (setvar 'cmdecho 1) (command "_.Undo" "E") (princ) )
    1 point
  5. if princ wasn't there it would repeat the last output to the command line or in this case it would output nil. https://www.youtube.com/watch?v=nnkX7M0Hikk&t=57s
    1 point
  6. This is a start, change to suit your input. (defun chklay (lay col lt / ) (if(not(tblsearch "LAYER" lay)) (command "-layer" "m" lay "c" col lay "lt" lt lay "") (princ "exist") ) (setvar 'clayer lay) ) You can set pline width using (setvar 'plinewid x)
    1 point
  7. 1 m3 = 7850 kg 1 ft3 = 490 lbs 1000000000 = 1e-09 use multiply. If object is mm.
    1 point
  8. entsel needs to have car because it returns the entity name and point of mouse click. entlast doesn't need car because its just the last entity name in the drawing database. Consolidated the code down a bit. (defun c:test (/ ent1 ent2 v p) (if (and (setq ent1 (car (entsel "\nSelect 1st Solid"))) (setq ent2 (car (entsel "\nSelect 2nd Solid")))) (progn (command "__subtract" ent1 "" ent2 "") (setq v (vlax-get-property (vlax-ename->vla-object (entlast)) 'Volume)) (setq p (/ (* v 7850) 1000000000)) ;check formula this seems off (prompt (strcat "\nArea = " (rtos v 2 3))) (prompt (strcat "\nPeso = " (rtos p 2 3))) ) ) (princ) )
    1 point
  9. This would help you with it . (defun c:TesT () (command "_.close" "_Y") (princ) ) Tharwat
    1 point
×
×
  • Create New...