How to change density of blocks
How to change density of blocks
(OP)
I am relatively new to Autocad.How can I change densities of a block so that when I list mass properties,Volumes and Mass give different values
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
How to change density of blocks
|
How to change density of blocksHow to change density of blocks(OP)
I am relatively new to Autocad.How can I change densities of a block so that when I list mass properties,Volumes and Mass give different values
Red Flag SubmittedThank you for helping keep Eng-Tips Forums free from inappropriate posts. Reply To This ThreadPosting in the Eng-Tips forums is a member-only feature.Click Here to join Eng-Tips and talk with other members! |
ResourcesWhat is rapid injection molding? For engineers working with tight product design timelines, rapid injection molding can be a critical tool for prototyping and testing functional models. Download Now
The world has changed considerably since the 1980s, when CAD first started displacing drafting tables. Download Now
Prototyping has always been a critical part of product development. Download Now
As the cloud is increasingly adopted for product development, questions remain as to just how cloud software tools compare to on-premise solutions. Download Now
|
RE: How to change density of blocks
I think the BLOCK in your mind is 3DSOLID.
AutoCAD supposes the dfault density equal to 1 for all
3DSolids. You have to multiple the required density to
the calculated volume or mass (by the MASSPROP command) to
achieve the real mass.
The below VisualLISP code calculates the mass for 3DSolids.
The length units must be in millimeters and the material
is supposed to be steel. All you have to do is:
1. Copy and paste the below expressions into a file.
2. Save the file named WEIGHT.LSP
3. In AutoCAD environment load the file using the APPLOAD
command.
4. Type "WE" in the command line and press ENTER.
5. Select 3DSolid objects.
6. The exact weight will be calculated.
(defun c:WE( / ss TotVol TotMass n m e vla-e)
(if (null vlax-ename->vla-object)
(vl-load-com)
)
(setq ss (ssget '((0 . "3DSOLID"))))
(setq TotVol 0.0)
(setq n 0)
(setq m (sslength ss))
(while (< n m)
(setq e (ssname ss n))
(setq vla-e (vlax-ename->vla-object e))
(setq TotVol (+ TotVol (vla-get-volume vla-e)))
(setq n (1+ n))
)
(setq TotMass (* TotVol 7860e-9))
(terpri)(princ TotMass)(terpri)
(princ)
)
I have written a faster code in AutoCAD VBA. If you like I
can send it to you. My email address:
heydarif@yahoo.com
Regards,
Farzad
RE: How to change density of blocks
The latest AutoCAD versions doesn't have this feature? This is what I understand from your excellent answer.
Regards
Fernando
RE: How to change density of blocks
Your guess is true. AutoCAD does not include the mentioned feature, but in Autodesk Mechanical Desktop you can assign a density and other properties to each part.
Regards,
Farzad
RE: How to change density of blocks
If anyone wants to take a stab at creating a dialog for this, I would be greatful.
;This program draws a point at the centroid of a
;region or solid. The point is drawn on the current
;layer at the current settings. It creates a file
;called deleteme.mpr in c:\temp directory that can
;be deleted if wanted, otherwise the program will
;just overwrite it everytime it runs.
(defun c:CG2002 (/ ss mprfile title c-steel s-steel alumn UHMW Neoprene Pine )
(setq c-steel 0.2833
s-steel 0.286
alum 0.098
UHMW 0.0347
Neoprene 0.045
Pine 0.022)
(setvar "filedia" 0)
(setvar "cmdecho" 0)
(print "Select solids or regions")
(setq ss (ssget))
(command "massprop" ss "" "y" "c:/temp/deleteme")
(setvar "filedia" 1)
(setq mprfile (open "c:/temp/deleteme.mpr" "r"))
(read-line mprfile)
(setq title (read-line mprfile))
(close mprfile)
(if (= nil (wcmatch title "*REGION*")) (CG-SOLID) (CG-REGION))
)
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(defun CG-REGION (/ mprfile area-line x-line y-line x-coord
area-size y-coord point-coord old-osnap
weight-cs weight-ss weight-al weights)
(setq mprfile (open "c:/temp/deleteme.mpr" "r"))
(repeat 3 (read-line mprfile))
(setq area-line (read-line mprfile))
(repeat 3 (read-line mprfile))
(setq x-line (read-line mprfile))
(setq y-line (read-line mprfile))
(close mprfile)
(setq area-size (atof(substr area-line 25))
weight-cs (* area-size c-steel)
weight-ss (* area-size s-steel)
weight-al (* area-size alum)
weight-UHMW (* area-size UHMW)
x-coord (atof(substr x-line 25))
y-coord (atof(substr y-line 25))
point-coord (list x-coord y-coord)
old-osnap (getvar "osmode")
)
(setvar "osmode" 0)
(command "point" point-coord)
(setvar "osmode" old-osnap)
(setq weights (strcat "Weights at 1 inch thick: " (rtos weight-cs 2 1) "# cs, "
(rtos weight-ss 2 1) "# ss, " (rtos weight-al 2 1) "# al " (rtos weight-UHMW 2 1) "# UHMW "))
(alert weights)
(print weights)
(princ)
)
;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
(defun CG-SOLID (/ mprfile vol-line x-line y-line z-line x-coord
y-coord z-coord vol-size point-coord old-osnap
weight-cs weight-ss weight-al weights)
(setq mprfile (open "c:/temp/deleteme.mpr" "r"))
(repeat 4 (read-line mprfile))
(setq vol-line (read-line mprfile))
(repeat 3 (read-line mprfile))
(setq x-line (read-line mprfile))
(setq y-line (read-line mprfile))
(setq z-line (read-line mprfile))
(close mprfile)
(setq vol-size (atof(substr vol-line 25))
weight-cs (* vol-size c-steel)
weight-ss (* vol-size s-steel)
weight-al (* vol-size alum)
weight-UHMW (* vol-size UHMW)
x-coord (atof(substr x-line 25))
y-coord (atof(substr y-line 25))
z-coord (atof(substr z-line 25))
point-coord (list x-coord y-coord z-coord)
old-osnap (getvar "osmode")
)
(setvar "osmode" 0)
(command "point" point-coord)
(setvar "osmode" old-osnap)
(setq weights (strcat "Weights: " (rtos weight-cs 2 1) "# cs, " (rtos weight-ss 2 1)
"# ss, " (rtos weight-al 2 1) "# al " (rtos weight-UHMW 2 1) "# UHMW "))
(alert weights)
(print weights)
(princ)
)
RE: How to change density of blocks
Regards Mooslim
RE: How to change density of blocks
I tried your calculation and it works great! You should e-mail this to Autodesk. Since version 13 or before, they have never addressed this in later updates (?). Maybe their programmers can take a break from writing useless code and take the time to include something a little more valuable like this in the next AutoCad version, whenever that may be(?).
Mike Waugh
RE: How to change density of blocks
But a simpler solution would be to find the mass vaule for a particular material and multiply the volume number you get back from the massprop command by that. For instance, I know that the value for steel is .2833 X the total cubic inches. That's it. Done.
Yes, sorry Adesk in their "wisdom" chose not to include that step in their code, but jeez! (I AM flummoxed by their including the mass line and the volume line in the massprop command report, with a factor of 1! Couldn't they have added the extra step to input a factor other than 1? oh well.)
Additionally, I'll also create a set of attributes for EACH PART,(YES EACH PART- especially in 3D design, but also in 2D) one of which includes the answer I got for that part when I did the weight step above. I can then click on a part and (re)learn things about it down the road, or run an extract using std acad out to an excel sheet and perform a composite weight takeoff.
Writing values to an external text file that will be overwritten each time seems an interesting if cumbersome approach, but the code seems imaginative!I'll give it a try.
GOOD LUCK!
RE: How to change density of blocks
-or other- will have various standard materials used in everyday production, including Steel in various flavors, SST similarly, Brass, Bronze, Aluminum etc., and even some plastics. Material variations not necessarily listed are likely very close to materials that ARE listed, especially for reasonable composite estimates.
Just find a 1" sq. bar of any material, find the minimum value listed (usually 1') and divide the bar weight by 12. You'll be surprised how cose the value will be. I've never encountered one that didn't come out correct to 3+ dec plcs.
If your needs are more precise, call a materials vendor. In about 5 minutes you can have values for dozens of materials.
GOOD LUCK!