Hachi Posted January 10, 2021 Posted January 10, 2021 Dear Members! Problem part I I now turn to you with the question of how to extract certain data from the "_massprop" command and assign it to a variable immediately. I am working on an automation task where a cable cross section has to be pulled out on a given 3D polilyne path. I need to extract the volume of the resulting 3D solid to calculate the volume of the displaced top. Problem part II Similarly, I should extract the length of the extracted 3D tube from the property table. This data is available if I extract the cross section with the _extrude / path command. I have to assign the extracted data to a variable within the lisp program to perform a mathematical operation on it. As follows: (setq V (volume data from the _massprop command)) (setq Vm (/ V (1000 ^ 3)); converting the mm3 to m3 Problem part III I would like to write the obtained result in a table in the model space. Column 1: "Volume of ground displaced by the pipeline" Colum 2: "The result of the calculation (which will be the value of a variable Vm)" Here is my code for calculation the cross section of the cable and to extrude it. The polyline must to be placet at '(0 0 0) All help comes in handy: (defun c:kabel(/ K_A K_AKEM K_DKE K_DKEM K_H K_L K_PT0 K_PT1 K_PT2 K_PT3 K_PT4 K_PT5 K_RKE K_RKEM K_RTOT K_SS1 K_V PIR) (setq K_Dke (getreal "Adja meg a kábel ér külső átmérőjét:")); Give me the diameter of the subcable (setq K_Akem (getreal "Adja meg a kábel ér magjának keresztmetszet területét (mm2)-ben) :")); Give me the copper cross section area (setq K_L (getreal "Adja meg a beillesztett polilyne teljes hossszát m-ben:")); Give me the length of the cable route (setq pir 3.141592654) (setq K_Dkem (sqrt (/ (* K_Akem 4) pir))); The copper diameter (setq K_Rke (/ K_Dke 2)) (setq K_Rkem (/ K_Dkem 2)) (setq K_pt0 '(0 0 0)) ; The low right cable part (you have 3 of them) (setq K_pt1 (polar K_pt0 (* pi 0.666666666666) K_Dke )); The center position of the upper cable part (setq K_pt2 (polar K_pt0 pi K_Dke)); The center of the third cable part ( part 3 of 3) (setq K_h (* K_Dke (sin (/ pi 3)))) (setq K_pt3 (polar K_pt2 0 (/ K_Dke 2))) (setq K_pt4 (polar K_pt3 (/ pi 2) (* K_h 0.333333333333)));The outer circle center point calculated from 3 cabel parts which are 120 degree from each other, like a mercedes logo (setq K_Rtot (+ K_Rke (* K_h 0.666666666666666))); Radius of the cable pipe (setq K_pt5 (polar K_pt4 (/ pi 2) K_Rtot)) (command "_circle" K_pt4 K_Rtot "") (setq K_ss1 (ssget "_L")) (command "_extrude" "_Mode" "_solid" K_ss1 "" "_path" '(0 0 -0.1) "") (setq K_A (* (* (/ K_Rtot 1000) (/ K_Rtot 1000)) pir)) (setq K_V (* K_A K_L)) (alert (strcat "The volume of the cable=" (rtos K_V) "m3")) (princ) ) Quote
BIGAL Posted January 11, 2021 Posted January 11, 2021 You can write massprop to a file then read it again to get values returned by massprop. Volume in Bricscad is 2nd line. Write analysis to a file?[Yes/No] <No>: Quote
Hachi Posted January 11, 2021 Author Posted January 11, 2021 1 hour ago, BIGAL said: You can write massprop to a file then read it again to get values returned by massprop. Volume in Bricscad is 2nd line. Write analysis to a file?[Yes/No] <No>: Dear BIGAL! Thank you for your replay, but in manual I know for that option... I'm interested in how to extract that number automatically in AUTOLISP like this: (commad "massprop" "") (setq Vname ~as string~ (here goes the code to read the desired parameter name)) (setq V (here goes the code to read the parameter value) ;and (setq L (here goes the code to read the length of the polilyne from the properties table) ;By property table I mean (Ctrl+1) Quote
BIGAL Posted January 11, 2021 Posted January 11, 2021 Should have looked using dumpit.lsp Volume is a property. So your home work is Vla-get-theproperty vlaobject ; shorthand version of dumpit.lsp (vlax-dump-object (vlax-ename->vla-object (car (entsel "Pick obj")))) Quote
Hachi Posted January 26, 2021 Author Posted January 26, 2021 On 1/12/2021 at 12:50 AM, BIGAL said: Should have looked using dumpit.lsp Volume is a property. So your home work is Vla-get-theproperty vlaobject ; shorthand version of dumpit.lsp (vlax-dump-object (vlax-ename->vla-object (car (entsel "Pick obj")))) Thank you for dumpit. It works very well, but I can't find any method that works and reads the dumped volume data and associates it with a variable that I create with "setq". I've visited a million forums and pages already but can't find how to extract the volume variable from the dupit "popup" window and assign it to a variable within lisp. It's been 2 weeks and I've run out of ideas. Anyway, it’s all part of an even bigger automation task. I’ve already written to Lee through his website (3 weeks ago) but haven’t responded yet. I’m actually looking for someone who would solve a company’s automation problem. I was asked, but since I am not on that level I am looking for an outsider. Bigal might you be interested in the details? If so, please write to vallalkozas.acad@gmail.com and I will send you a description of the task and all the necessary materials so that you can assess the weight of the task. Quote
BIGAL Posted January 27, 2021 Posted January 27, 2021 There are a few here that maybe can help not just me. Will send you a email etc. Perhaps describe here briefly what you want automated and others may have a more suitable skill set. (setq obj (vlax-ename->vla-object (car (entsel "Pick solid object")))) (setq vol (vlax-get obj 'volume)) This code would have a error check make sure you picked a solid. 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.