Jump to content

Search the Community

Showing results for tags 'calculate mass blocks'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 1 result

  1. I frankenbuild 2 autolisp scripts to output the mass of a solid (in mm density is from steel 0.00782 g/mm^3/7820 kg/m^3 ) It also explodes all blocks and then undo that, so your blocks are unharmed, but this way it also uses the solids in those blocks. The volume code is from lee mac: http://www.cadtutor.net/forum/showthread.php?37358-how-to-Pick-the-Value-of-Volume The explode code is also from lee mac: http://www.cadtutor.net/forum/showthread.php?53107-Xplode-All-Blocks This is my franken build code: (remember output is from a part in mm) (defun c:vol (/ ss vol bset |cmdecho|) (vl-load-com) (SETQ |cmdecho| (GETVAR "cmdecho")) (SETVAR "cmdecho" 1) (COMMAND "undo" "begin") (c:ExplodeAllBlocks) (COMMAND "undo" "end") (if (setq ss (ssget '((0 . "3DSOLID")))) (progn (setq vol (apply '+ (vl-remove-if 'vl-catch-all-error-p (mapcar (function (lambda (x) (vl-catch-all-apply 'vla-get-volume (list x)))) (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))))))) (command "undo" "")(princ (strcat "\n<< Total Volume = " (rtos vol 2 2) " >>")) (setq volume (rtos vol 2 2)) )) (setq massa (* 0.00782 vol))) (PRINC (strcat "\n<<mass:" (rtos (/ massa 1000) 2 2) " kg >>")) (princ) (SETVAR "cmdecho" |cmdecho|) ) Explode block lisp from lee mac (defun c:ExplodeAllBlocks ( / *error* _StartUndo _EndUndo doc locked ss ) (vl-load-com) ;; © Lee Mac 2010 ;; Error Handler (defun *error* ( msg ) (if locked (mapcar (function (lambda ( l ) (vl-catch-all-apply 'vla-put-lock (list l :vlax-true)) ) ) locked ) ) (if doc (_EndUndo doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (defun _StartUndo ( doc ) (_EndUndo doc) (vla-StartUndoMark doc) ) (defun _EndUndo ( doc ) (if (= 8 (logand 8 (getvar 'UNDOCTL))) (vla-EndUndoMark doc) ) ) ;; Start an Undo Mark (_StartUndo (setq doc (vla-get-ActiveDocument (vlax-get-acad-object) ) ) ) ;; Unlock all Layers (vlax-for l (vla-get-layers doc) (if (eq :vlax-true (vla-get-lock l)) (progn (vla-put-lock l :vlax-false) (setq locked (cons l locked)) ) ) ) ;; Now lets explode 'em (if (ssget "_X" '((0 . "INSERT"))) (progn (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc)) (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-Explode (list obj)) ) (princ (strcat "\n** Unable to Explode Block: " (vla-get-name obj) " **")) (vla-delete obj) ) ) (vla-delete ss) ) ) ;; ReLock the Layers (mapcar (function (lambda ( l ) (vla-put-lock l :vlax-true)) ) locked ) ;; End the Undo mark (_EndUndo doc) ;; Exit Cleanly (princ) )
×
×
  • Create New...