eyal Posted March 29, 2017 Posted March 29, 2017 Hi, I have an idea for a lisp , but I don't know how to do it. I want a lisp that first asks for polygon , then it asks for thickness (mm), and then the user can place the text with the result on the drawing. the result should be : (the area of the closed polygon (mm)*7.85*thickness)/E6 E6 = for converting the weight to Kg. I would be glad if someone could help me with this. Quote
OMEGA-ThundeR Posted March 29, 2017 Posted March 29, 2017 Should the polygon allready be drawn? (selecting existing closed polyline) or do you want to draw it first ? Quote
eyal Posted March 29, 2017 Author Posted March 29, 2017 Yes , the polygons already exists. with the lisp I want : 1. to pick an existing polygon 2. input thickness 3. I want the list to let me place a text with the result. Thank you!! Quote
OMEGA-ThundeR Posted March 29, 2017 Posted March 29, 2017 (edited) Ok, i made something... I guess it ain't pretty, but it is pretty simple to modify. Don't know if the calculations are correct, but changes should be pretty strait forward:" (Defun C:calculate (/ Polygon Polyarea Thickness E6 PlacePoint Volume Mass) ;; Get the info (setq Polygon (vlax-ename->vla-object(car(entsel "\nSelect Polygon:")))) (setq Polyarea (vla-get-area Polygon)) (setq Thickness (getint "\nGive Thickness in MM: ")) (setq E6 (getint "\nGive E6 value: ")) (setq PlacePoint (getpoint "\nPick point of text placement: ")) ;; Do some calculations: (setq Volume (* Polyarea 7.85 Thickness)) (setq Mass (/ Volume E6)) ;debugging- Can be deleted! (princ "\n *************** DEBUGGING *************** ") (princ "\n Area of Polygon:") (print Polyarea) (princ "\n Thickness given:") (print Thickness) (princ "\n E6 given:") (print E6) (princ "\nCoordinates of text insertionpoint :") (print PlacePoint) (princ "\nVolume calculated:") (print Volume) (princ "\nMass Calculated:") (print Mass) (princ "\n ************* END DEBUGGING *************\n\n") ; End debug ;; Place the text (command "_text" "J" "MC" PlacePoint "0" Mass "") (princ) ) Without the debugging part: (Defun C:calculate (/ Polygon Polyarea Thickness E6 PlacePoint Volume Mass) ;; Get the info (setq Polygon (vlax-ename->vla-object(car(entsel "\nSelect Polygon:")))) (setq Polyarea (vla-get-area Polygon)) (setq Thickness (getint "\nGive Thickness in MM: ")) (setq E6 (getint "\nGive E6 value: ")) (setq PlacePoint (getpoint "\nPick point of text placement: ")) ;; Do some calculations: (setq Volume (* Polyarea 7.85 Thickness)) (setq Mass (/ Volume E6)) ;; Place the text (command "_text" "J" "MC" PlacePoint "0" Mass "") (princ) ) Edited March 29, 2017 by OMEGA-ThundeR Quote
BrianTFC Posted April 3, 2017 Posted April 3, 2017 Eyal, Go here scroll down his list and you will find a "WEIGHT" program that works great. http://www.jefferypsanders.com/autolisp.html Quote
jetxcc Posted July 1, 2020 Posted July 1, 2020 What has happened to the http://www.jefferypsanders.com/autolisp.html website? every time I've tried to go there it says: This site can’t be reached www.jefferypsanders.com’s server IP address could not be found. Try running Windows Network Diagnostics. DNS_PROBE_FINISHED_NXDOMAIN Quote
BrianTFC Posted July 2, 2020 Posted July 2, 2020 All, Jetxcc here is the lisp routine that I was talking about since Jeff's site is down. WEIGHT.dcl WEIGHT.lsp 1 Quote
jetxcc Posted July 7, 2020 Posted July 7, 2020 Thank you Brian TFC. I'm currently having issues with the DLC not being recognized as being in the search path. But I'm sure I'll get it sooner or later. Thanks again. But does anybody know why JPS website is no longer working? or is it just me? Quote
BrianTFC Posted July 7, 2020 Posted July 7, 2020 it works better if the lisp and the dcl are in the same folder. Quote
BrianTFC Posted July 7, 2020 Posted July 7, 2020 btw how did you download the attachments? I found some that I want to download but it won't let me. Quote
jetxcc Posted July 7, 2020 Posted July 7, 2020 (edited) I clicked on the link that you provided, downloaded the lsp & dcl files. cut and paste them into my lisp folder with all of my other lisp routines did the app load and nothing. I'm about to try a CAD shut down and reopen to see if that does it or not. the shut down and restart of CAD seems to have done it. Edited July 7, 2020 by jetxcc Quote
eyal Posted July 8, 2020 Author Posted July 8, 2020 Hi @BrianTFC, Thank you for the lisp. but I can't fint the steel density 7.85 g/cm3 . and I work with this density , where can I change it in the lisp? Thank you Quote
BIGAL Posted July 8, 2020 Posted July 8, 2020 Why not use the code by Omega-thunder ? I had a bit of play with it added multi picks. It needs check picked a valid object pline or circle. And Material type say add Aluminimum. The code by Jeffery sanders has nearly any type of material which is good but adds overheads. (Defun C:calculate (/ Poly Thick sc Pt Vol) (setq Thick (getreal "\nGive Thickness in MM: ")) (setq sc (getreal "\nGive scale value 1 0.1 0.001 : ")) (while (setq ent (entsel "\nSelect Polygon:")) (setq Poly (vla-get-area (vlax-ename->vla-object (car ent)))) (setq Pt (getpoint "\nPick point of text placement: ")) (setq Vol (rtos (* Poly 7.85 Thick sc) 2 3)) (command "_text" Pt 20 0.0 Vol) ) (princ) ) (C:calculate) 1 Quote
eyal Posted July 8, 2020 Author Posted July 8, 2020 Hi BrianTFC, I liked you lisp , that I can choose from a list the density, but as I said I use steel density of 7.85 g/cm3 I want to change values in your list for specific materials ( also I use mm units) in your list I found this: "437.0" ; Iron, ferro-silicon "325.0" ; Iron ore, hematite "170.0" ; Iron ore, hematite in bank "145.0" ; Iron ore, hematite loose "237.0" ; Iron ore, limonite "315.0" ; Iron ore, magnetite "172.0" ; Iron slag "710.0" ; Lead "465.0" ; Lead ore, galena "112.0" ; Magnesium, alloys "475.0" ; Manganese "259.0" ; Manganese ore, pyrolusite "849.0" ; Mercury "556.0" ; Monel Metal "565.0" ; Nickel "1330.0" ; Platinum, cast, hammered "656.0" ; Silver, cast, hammered "453.0" ; Steel, rolled "459.0" ; Tin, cast, hammered "418.0" ; Tin ore, cassiterite "440.0" ; Zinc, cast, rolled "253.0" ; Zinc ore, blende as you can see steel rolled is 453 what is this value? , it supposed to be 7.85 g/cm3 I don't understand the values here. Can you change the density list to be in g/cm3 Density (near r.t.) 7.874 g/cm3 https://en.wikipedia.org/wiki/Iron Thank you, Eyal Quote
BIGAL Posted July 9, 2020 Posted July 9, 2020 (edited) Metric v's imperial Also if working always in mm then you can put the 7.85 as a correct value to give Kg's as answer Found this Weight per sq. feet of hot rolles mild steel plates can be calculated as W = 40.8 t (1) where W = weight of steel plate (lb/ft2) t = plate thickness (in) 7.85kg / sq m. for 1mm plate so work out you mm x mm x weight put in my code. Edited July 9, 2020 by BIGAL Quote
eyal Posted July 9, 2020 Author Posted July 9, 2020 Hi Bigal, Sorry but I didn't understand what did you mean. in your code: "453.0" ; Steel, rolled what is this value. I don't know where to change the values to 7.85kg / sq m Can you please fix the values for the steel rolled? , and I fix the rest of the values according to your example. I work in metric units , I don't know how to work with feet. Regards. Eyal Quote
devitg Posted July 9, 2020 Posted July 9, 2020 You do not need to change nothing . as the lisp calculate as VOL (setq Vol (rtos (* Poly 7.85 Thick sc) 2 3)) so vol = area [m2] times thick [mm] times 7.85 kg/ 1 m2 1 mm thick If you want to calculate for Aluminum , change 7.85 for 2.71 . or whatever specific weight the material is Quote
DELLA MAGGIORA YANN Posted February 27 Posted February 27 On 7/2/2020 at 1:28 PM, BrianTFC said: Tout Jetxcc voici la routine de zézaiement dont je parlais puisque le site de Jeff est en panne. POIDS.dcl 2.8 kB · 30 téléchargements POIDS.lsp 27.01 kB · 40 téléchargements HI Can you tell me where to place the DCL file please? THANKS 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.