Jump to content

Search the Community

Showing results for tags 'centroid'.

  • 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 4 results

  1. Hi Is there a way to create a macro which would find the inertia of a region out the (0,0)? Currently, I have to Massprop the object, draw a line from (0,0) to the centre of the object, move the object from the end of the line to the centroid, and then massprop it again to get the correct Ixx and Iyy values. I have looked into creating a macro for it, but I don't know how to use the initial centre values to move the object to (0,0). Is there a way to do this via amacro? If not, is there any other method unknown to me to find the Iyy and Ixx values of an object as if it is sitting at (0,0)? Thanks in advance, hope this all makes sense.
  2. I work as a boat designer and often require calculating total length of polyline & centre of gravity (both open & closed polylines). I have a snippet below to show the sample code I am currently using - this only works with a group of lines - it doesnt work with polylines. Currently everytime I have to calculate the CG, I have to copy the polyline over, explode it & select the lines to calculate the CG. The logic is as follows - assuming we have 3 segments on the polyline(A,B,C) : Centre of Gravity of Polyline = (Len of A multiplied by Centroid of A + Len of b multiplied by Centroid of B + Len of C multiplied by Centroid of C) divided by Total Length of polyline I am new to LISP & although have some background in other programming languages, find it is relatively difficult to write the code, the syntax being very different. I found a similar code ( TotalADD Total Addition by Andrea Andreetti & modified to come to the below code). It would be ideal if I can select a group of polylines (using select similar) and run the command to get a text table in autocad with CG & total length calculated for set of polylines on different layers. But I am not sure how this can be achieved. Would you be able to help or am I asking for too much ? any guidance will be much appreciated. (if (eq (vla-get-objectname n) "AcDbLine") (progn (setq itemlinelength (+ itemlinelength (vla-get-length n))) (setq StartPoint(vlax-safearray->list (vlax-variant-value (vla-get-startpoint n)))) (setq x1 (car Startpoint)) (setq y1 (cadr Startpoint)) (setq EndPoint(vlax-safearray->list (vlax-variant-value (vla-get-endpoint n)))) (setq x2 (car endpoint)) (setq y2 (cadr endpoint)) (setq xmid (* (+ x1 x2) 0.5)) (setq ymid (* (+ y1 y2) 0.5)) (setq xmom (* xmid (vla-get-length n))) (setq ymom (* ymid (vla-get-length n))) (setq itemxmoment (+ itemxmoment xmom)) (setq itemymoment (+ itemymoment ymom)) ) ) (setq totxcg (/ itemxmoment itemlinelength)) (setq totycg (/ itemymoment itemlinelength)) (setq tlength (rtos itemlength 2 ) (setq totxcg (rtos totxcg 2 ) (setq totycg (rtos totycg 2 ) (acet-ui-status (strcat "Length: " tlength "\n" "X CoG Pos: " totxcg "\n" "Y CoG Pos: " totycg "\n" )
  3. Hi everyone, here's what I'm trying to do: I have a lot of curved bridge girders, and I am using MASSPROP to find the centroid location, and then manually typing in the centroid coordinates as the center point of a sphere. Awhile back, I found this code that is supposed to do precisely that, but these days it is adding a sphere at a corner point, not the centroid. Any help would be greatly appreciated! (defun c:masscent(/ sset1 slng1 cnt1 cnt2 clist sent1 xlist ylist zlist xpt ypt zpt cpt rad vol1 vlist ucp) (vl-cmdf "._undo" "_end") (vl-cmdf "._undo" "_group") (vl-cmdf "._ucs" "_w") (prompt "\nSelect solids for centroid location. ") (setq sset1 (ssget) slng1 (sslength sset1) cnt1 0 cnt2 0 clist nil ) (repeat slng1 (setq sent1 (vlax-ename->vla-object (ssname sset1 cnt2))) (if (vlax-property-available-p sent1 "Centroid") (progn (setq clist (append clist (list (vlax-get sent1 "Centroid")))) (setq vlist (append vlist (list (vlax-get sent1 "Volume")))) (setq cnt1 (1+ cnt1)) ) ) (Setq cnt2 (1+ cnt2)) ) (setq xlist (mapcar 'car clist)) (setq xpt (car xlist)) (setq ylist (mapcar 'cadr clist)) (setq ypt (car ylist)) (setq zlist (mapcar 'caddr clist)) (Setq zpt (car zlist)) (setq vol1 (car vlist)) (repeat (fix (- (vl-list-length clist) 1)) (setq xlist (cdr xlist)) (setq xpt (+ xpt (car xlist))) (setq ylist (cdr ylist)) (setq ypt (+ ypt (car ylist))) (setq zlist (cdr zlist)) (setq zpt (+ zpt (car zlist))) (setq vlist (cdr vlist)) (Setq vol1 (+ vol1 (car vlist))) ) (setq cpt (list xpt ypt zpt)) (setq cpt (mapcar '(lambda (x) (/ x cnt1)) cpt)) (setq vol1 (strcat (rtos vol1 2 5) " cu. in.")) (setq rad (getreal "\nEnter radius: ")) (vl-cmdf "._sphere" cpt rad) (vl-cmdf "._ucs" "_p") (vl-cmdf "._undo" "_end") (princ "\n") (princ "Centroid point: ") (princ cpt) (princ (strcat " - Volume: " vol1)) (princ) )
  4. I need to divide a bridge deck section (sort of trapezoidal shape with circular hollow section inside) but I need to keep the centroid level of each section to be at the same height. is there any simple way of doing it using Autocad 2014?
×
×
  • Create New...