JimmyCoxy Posted December 4, 2020 Posted December 4, 2020 Hi all, I am creating 2D shapes, some solid and some with hollows in them. Currently, we create regions, run massprop command and then apply math to the area to generate a weight for the shape and manually type onto the model space. I would like to use the contours I have created (both int and ext) to generate various data that is then put to an MText input on the mouse to be placed in the drawing as needed. Once the contours for the shape are created, I would like to then be able to list the following data from it: Weight (Simple area x density calc) Shape Area Inside Perimeter Outside Perimeter Does anyone know of the script to achieve this or any sort of guidance at all would be greatly appreciated. Quote
BIGAL Posted December 7, 2020 Posted December 7, 2020 Sounds like TIN modelling, then can get volumes etc. Have you looked at TIN's Triangular Irregular Network. There is some free software here "TriangV0.5.9.lsp" version may be newer. Quote
JimmyCoxy Posted December 7, 2020 Author Posted December 7, 2020 Hi Bigal, Not sure what you are talking of here. See below for a quick eg of what I am trying to do ie: Work out the weight of a simple 2D shape I can do it all long hand but want CAD to do this for me in a quick button press. Basically, I want to be able to select the outer shape (red) and then select any inner shapes (blue). CAD will then work out the area of the shapes and then also the weight. Once known, give it to me on an MText input so I can put it on the drawing. It is simple to do when using square shape but when shape is irregular, it is difficult. Quote
ammobake Posted December 7, 2020 Posted December 7, 2020 (edited) So currently you are calculating weight manually? Edited December 7, 2020 by ammobake Quote
lrm Posted December 7, 2020 Posted December 7, 2020 @JimmyCoxy Assuming the shapes are closed polylines you can use the area command with the following sequence. Give the area command followed by A (add) then O (object) pick the outer boundary, hit the space bar then S (subtract) then O (object) and pick the inner boundaries and you will see the Total area = ... . Swipe the area value and use Ctrl-C to copy it to the clipboard then give the mtext (or text) command and paste the area value with Ctrl-V you copied. Of course the process could be streamlined with a vlisp program. Quote
BIGAL Posted December 8, 2020 Posted December 8, 2020 A TIN of the shape would be like the pyramid solid option. You can then get a volume. A function of the difference of 2 surfaces. Quote
JimmyCoxy Posted December 14, 2020 Author Posted December 14, 2020 @lrm That is exactly what I am trying to do with an added step of multiplying the worked out area by a material density (known number) to give me a weight value too. If it is also possible to add in data from an AMINERTIA command such as Ixx and Iyy values, that would also help greatly. The lisp file is exactly the sort of thing I need but am unable to do this myself as have never attempted before and don't even know where to start. Quote
lrm Posted December 14, 2020 Posted December 14, 2020 Perhaps the following CalWeight program will help. No error checking is done. It assumes you will be selecting 2 closed polylines. (vl-load-com) (defun c:CalWeight (/ den util area1 area2 wgt pt) (setq den (getreal "\nEnter material density.")) (setq util (vla-get-utility (vla-get-activedocument (vlax-get-acad-object) ) ) ) (vla-getentity util 'obj1 'ip "\nSelect Outer Shape. ") (vla-getentity util 'obj2 'ip "\nSelect Inner Shape: ") (setq area1 (vlax-curve-getArea obj1)) (setq area2 (vlax-curve-getArea obj2)) (setq wgt (* den (- area1 area2))) (setq pt (getpoint "\nSpecify where to place text?")) (command "_text" pt "" "" wgt) (princ) ) Quote
ammobake Posted December 14, 2020 Posted December 14, 2020 I think this lisp would need some updating to include more geometry data per the ops post. Also, Calweight requires a "material density" input but it isn't clear what this is asking for. "\nEnter material density.")) Is this looking for specific gravity/Relative density? In what units? Specific gravity calculations require a source material, like water, and then you can correctly represent your material's specific gravity as a ratio. IMO, Ideally, the lisp would be a block creation string creating an mleader callout with all the data points needed by the op - with a weight calc that requires a specific gravity ratio be input in whatever the current drawing units are. It could then run the calc based on the volume of the 3dsolid and automatically insert the weight value in the correct location on the block. -ChriS Quote
pkenewell Posted December 15, 2020 Posted December 15, 2020 (edited) This could be done easily with Lee Mac's Fieldmath function and add to a Multileader. First create an Area field in the Multileader, Then use Lee's function to add the material density constant to the Area. You will have to add it as a separate text then copy it into the Multileader below the original field. When copying you can used right-click > "Edit field" and add a prefix to the Fields. Then just add the Density line into it manually. I'm sure this could be done with a whole Visual / Auto LISP solution, but I don't have time to code it for you. Edited December 15, 2020 by pkenewell Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.