TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Scrutch on August 10, 2007, 01:18:53 PM

Title: 3D Solid Total Length
Post by: Scrutch on August 10, 2007, 01:18:53 PM
I am trying to build a routine that will return the total length of the 3D solids in a selection set.  I've tried multiple ways to do this but with the encrypted properties of the 3D solids am going in circles.  Also what would be the best way to get the selection set?  The 3d solids are on different layers...ie. lower, support, rack...etc.  Should I use a layer state save and then freeze everything else except the layer that has the 3D solids I want to get the total of?

The following code returns the largest value of the 3D solids in the Xplane, Yplane and Zplane...but I'm assuming that the length is larger than the height or width.  While 99.?? % of the time this would be true I suppose that it would be possible to get the wrong distance if the height or width were greater than the length.
The 3d solids I'm using are wbeam, channel, angle iron...etc.

I know very little about visual lisp but have a fair understanding of vanilla lisp.  Any and all help on this would be greatly appreciated.


Code: [Select]
;// Origianl code posted by naujoke ://
;// Formated & Function name catch by Adesu ://

(defun C:Solx ( / 3Ds sobj box los)
  (vl-load-com)
  (setq 3Ds (entsel "\n Select Solid :"))
  (if
    3Ds
    (progn
      (setq sobj (vlax-ename->vla-object (car 3Ds)))
      (if
 (= (vla-get-objectName sobj) "AcDb3dSolid")
 (progn
   (vla-getboundingbox sobj 'minpoint 'maxpoint)
   (setq box (mapcar '- (vlax-safearray->list maxpoint)
     (vlax-safearray->list minpoint)))
   (setq los (apply 'max box))
   (alert (strcat " Lenght of Solid = " (rtos los)))
   )    ; progn
 )      ; if
      )        ; progn
    )          ; if
  (princ)
  )            ; defun
Title: Re: 3D Solid Total Length
Post by: Mark on August 10, 2007, 03:24:14 PM
Quote
Also what would be the best way to get the selection set?

Maybe .....

Code: [Select]
(setq ss (ssget '((0 . "3DSOLID"))))
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 10, 2007, 04:15:26 PM
Quote
Also what would be the best way to get the selection set?

Maybe .....

Code: [Select]
(setq ss (ssget '((0 . "3DSOLID"))))

A bit of confusion here...my question on what the best way to get the ss was in relation to the layer state.  Should I try to isolate the layer or use some kind of filter.  I've just about finished setting this up...save the layer state, set the layer I want to count current, freeze all other layers, run the routine, restore the layer state and delete the saved layer state name.  This is all with the original code, picking a single object.

My major problem is how do I count the object that I've picked and total them up.  3D solids are a bit above my coding ability.  Here's the code where I'm trying to count the solids...not sure if I've got the counter set up in the right places or not but think so.  Thanks for responding Mark.

Code: [Select]
(defun C:SolxT ( / ) ; 3dss sobj box lenth)
  (vl-load-com)
(if
(setq 3dss (ssget '((0 . "3DSOLID"))))
;//(setq 3dss(ssget))
(progn
(setq sum 0)
(setq cnt 0)
(while
(< cnt (sslength 3dss))
  (if
    3dss
    (progn
    (setq sobj (vlax-ename->vla-object (car 3dss)))
      (if
      (= (vla-get-objectName sobj) "AcDb3dSolid")
        (progn ;// progn3
        (vla-getboundingbox sobj 'minpoint 'maxpoint)
        (setq box (mapcar '- (vlax-safearray->list maxpoint)
        (vlax-safearray->list minpoint)))
        (setq lenth (apply 'max box))
        ) ;// prg
      ) ;// if
    ) ;// prg
  ) ;// if
(setq sum(+ sum lenth))
(setq cnt(+ cnt 1))
) ;// if
) ;// prg
) ;// whl
(alert (strcat " Total Length of Solid = " (rtos lenth)))
  (princ)
) ;// defun
(princ)
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 10, 2007, 04:45:07 PM
Quote
Also what would be the best way to get the selection set?

Maybe .....

Code: [Select]
(setq ss (ssget '((0 . "3DSOLID"))))

With the 3d solids for example using the above code !ss does not return the name "3DSOLID" but rather the selection set number.  When I do a properties or an entget on one of these guys everything is encrypted...like I metioned before, a bit above me.  Hopefully someone will come along and shine a light on the path.
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 12, 2007, 12:27:17 PM
SSGET return a SELECTION SET, this is not a LIST , you have to build a list of all entyname.
A question , what kind of solid are you handling.??


(defun C:SolxT ( /
3D-OBJ
3DSS
ADOC
BOX
CNT
LENTH
MAXPOINT
MINPOINT
;;SUM
)
  (vl-load-com)
 (setq   adoc
    (vla-get-activedocument
      (vlax-get-acad-object)
    )
  );_ adoc is the current DWG

(setq 3dss (ssget "X" '((0 . "3DSOLID")  ;|(cons 8  "layer1,layer2,layer3")|; ))); it will get all 3d on all layers whatsever it´s state,
;;(ssget "X") creates a selection set of all entities in the drawing including those on layers that are frozen or off.
;; you can filter to get the 3d on the selected  layers  too
     
;//(setq 3dss(ssget       )); if you want to select by user
;; see more info here , about ssget http://ronleigh.info/autolisp/afude18.htm
 



(setq sum 0)
(setq cnt 0)


(setq 3d-obj ( vla-get-activeselectionset adoc ));_ all the solids at the dwg as OBJECTS



;;;(while
;;;(< cnt )
;;;  (if
;;;    3dss
;;;    (progn
;;;    (setq sobj (vlax-ename->vla-object (car 3dss)))
;;;      (if
;;;      (= (vla-get-objectName sobj) "AcDb3dSolid")

(vlax-for 3d 3d-obj;_ same as foreach but for OBJ
  ; you do not need to check for a solid as the ssget"X" get 3dsolids only
;;;        (progn ;// progn3

  ;;(setq 3d (vla-item 3d-obj 0)); used to get the first obj , just to test de following part
        (vla-getboundingbox 3d 'minpoint 'maxpoint)

 
        (setq box (mapcar '- (vlax-safearray->list maxpoint)
        (vlax-safearray->list minpoint)))


 
        (setq lenth (apply 'max box))
;;;        )   ;// prg
;;;      )   ;// if
;;;    )   ;// prg
;;;  )   ;// if
(setq sum(+ sum lenth))
(setq cnt(+ cnt 1))
;;;)   ;// if
;;;)   ;// prg
;;;)   ;// whl
sum
  );_ vlax-for

;;(alert (strcat " Total Length of Solid = " (rtos lenth))); you have to show the sum not the Length

(alert (strcat " Total Length of Solid = " (rtos sum)))
  (princ)
   
(princ)
);// defun
;;(C:SolxT)
 
;|«Visual LISP© Format Options»
(120 2 40 0 nil "end of " 100 20 1 2 0 T nil nil T)
;*** DO NOT add text below the comment! ***|;


Title: Re: 3D Solid Total Length
Post by: DEVITG on August 12, 2007, 01:35:57 PM

See your code in a other way to do it.


Code: [Select]
(defun C:SolxT ( /
3D-OBJ
3DSS
ADOC
BOX
CNT
LENTH
MAXPOINT
MINPOINT
;;SUM
)
  (vl-load-com)
 (setq adoc
(vla-get-activedocument
   (vlax-get-acad-object)
)
  );_ adoc is the current DWG

(setq 3dss (ssget "X" '((0 . "3DSOLID")  ;|(cons 8  "layer1,layer2,layer3")|; ))); it will get all 3d on all layers whatsever it´s state,
;;(ssget "X") creates a selection set of all entities in the drawing including those on layers that are frozen or off.
;; you can filter to get the 3d on the selected  layers  too
     
;//(setq 3dss(ssget       )); if you want to select by user
;; see more info here , about ssget http://ronleigh.info/autolisp/afude18.htm
 



(setq sum 0)
(setq cnt 0)


(setq 3d-obj ( vla-get-activeselectionset adoc ));_ all the solids at the dwg as OBJECTS



;;;(while
;;;(< cnt )
;;;  (if
;;;    3dss
;;;    (progn
;;;    (setq sobj (vlax-ename->vla-object (car 3dss)))
;;;      (if
;;;      (= (vla-get-objectName sobj) "AcDb3dSolid")

(vlax-for 3d 3d-obj;_ same as foreach but for OBJ
  ; you do not need to check for a solid as the ssget"X" get 3dsolids only
;;;        (progn ;// progn3

  ;;(setq 3d (vla-item 3d-obj 0)); used to get the first obj , just to test de following part
        (vla-getboundingbox 3d 'minpoint 'maxpoint)

 
        (setq box (mapcar '- (vlax-safearray->list maxpoint)
        (vlax-safearray->list minpoint)))


 
        (setq lenth (apply 'max box))
;;;        ) ;// prg
;;;      ) ;// if
;;;    ) ;// prg
;;;  ) ;// if
(setq sum(+ sum lenth))
(setq cnt(+ cnt 1))
;;;) ;// if
;;;) ;// prg
;;;) ;// whl
sum
  );_ vlax-for

;;(alert (strcat " Total Length of Solid = " (rtos lenth))); you have to show the sum not the Length

(alert (strcat " Total Length of Solid = " (rtos sum)))
  (princ)

(princ)
);// defun
;;(C:SolxT)
 
;|«Visual LISP© Format Options»
(120 2 40 0 nil "end of " 100 20 1 2 0 T nil nil T)
;*** DO NOT add text below the comment! ***|;
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 12, 2007, 08:26:48 PM
SSGET return a SELECTION SET, this is not a LIST , you have to build a list of all entyname.
A question , what kind of solid are you handling.??

Devitg,

Whoa...thought someone was going to teach me how to fish and you've given me a whale.
The solids I'm using are WBeam, Channel Iron, Angle Iron and what not.  I've built a routine that pops up the ones I use most of the time and asks for the direction and length, then draws it for me.  I suppose I could use blocks instead but I've been doing it this way for so long that I'm very cozy with it.

I'm posting a snippet of the code here...trying to get it to just pick a layer to get the length from because the WBeam, Channel Iron and Angle Iron need to be totaled individually for the bill of material.  Can you please show me what I'm doing wrong with the layer thing?  Perhaps it's because I'm using a space in my Layer Name...?  Then perhaps I can insert a user prompt to ask for which layer to measure.  Will this (cons 8  "layer1,layer2,layer3") statement return three individual measurements...one for each layer or is it going to be a total.  At the moment I get a value of 0'-0" from one layer or several.

Have no idea how this does all this without me picking anything...it will take me quite a while to figure out the code you've posted.  GREAT JOB and Thank you ever so much.

Code: [Select]
  (vl-load-com)
 (setq adoc
(vla-get-activedocument
   (vlax-get-acad-object)
)
  );_ adoc is the current DWG

;; (setq 3dss (ssget "X" '((0 . "3DSOLID")

(cons 8  "Beam Support")

;|(cons 8  "layer1,layer2,layer3")|;
;; )))
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 12, 2007, 08:49:49 PM

See your code in a other way to do it.

Sorry, copied from the wrong place...these variations are what I've been trying to use to get a single layer...

(setq 3dss (ssget "X" '((cons 8  "Beam Lower"))))
(setq 3dss (ssget '((cons 8  "Beam Lower"))))
(setq 3dss (ssget (cons 8  "Beam Lower")))
Title: Re: 3D Solid Total Length
Post by: Kerry on August 12, 2007, 09:01:48 PM
Try

(setq 3dss-ALL  (ssget "X" (list (cons 8 "Beam Lower"))))

(setq 3dss-SELECT (ssget (list (cons 8  "Beam Lower"))))
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 12, 2007, 10:25:56 PM
Hi Scrutch, can you send, or post,  a sample dwg .?
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 12, 2007, 10:47:55 PM
Hi Scrutch, can you send, or post,  a sample dwg .?

Devitg,

This is saved as a 2000 drawing...I've got clients that have never moved forward.
I removed all the xrefs and zipped it up for you...way to big otherwised.

Thanks again for the help. :-)
Ok, now I got to figure out how to add an attachment to this guy... :?
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 12, 2007, 10:52:52 PM
Try

(setq 3dss-ALL  (ssget "X" (list (cons 8 "Beam Lower"))))

(setq 3dss-SELECT (ssget (list (cons 8  "Beam Lower"))))

Thanks Kerry...really do appreciate all the attention I'm getting here.
What a nice place this is... :-)
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 12, 2007, 11:12:12 PM
Try

(setq 3dss-ALL  (ssget "X" (list (cons 8 "Beam Lower"))))

(setq 3dss-SELECT (ssget (list (cons 8  "Beam Lower"))))

Kerry,

Strange...
(setq 3dss-ALL  (ssget "X" (list (cons 8 "Beam Lower"))))
Automatically returns total length of all solids from all layers

(setq 3dss-SELECT (ssget (list (cons 8  "Beam Lower"))))
Returns total length of all solids selected regardless of the layer they are on.
 :?
Title: Re: 3D Solid Total Length
Post by: Kerry on August 12, 2007, 11:15:01 PM
You're welcome.
Some days you may not appreciate the attention ...

ps: I'm not all that pleasant, really .. so don't start feeling too comfortable. :|
Title: Re: 3D Solid Total Length
Post by: Kerry on August 12, 2007, 11:20:59 PM
I just downloaded your sample drawing,

(setq 3dss-ALL  (ssget "X" (list (cons 8 "Beam Lower"))))
should return nil as there is no layer named "Beam Lower" in the drawing
Title: Re: 3D Solid Total Length
Post by: Kerry on August 12, 2007, 11:25:10 PM
.... and it is not possible for that construct to return anything other than nil or a selection set.


ie
(setq 3dss-ALL  (ssget "X" (list (cons 8 "Beam Rack"))))
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 12, 2007, 11:35:33 PM
I just downloaded your sample drawing,

(setq 3dss-ALL  (ssget "X" (list (cons 8 "Beam Lower"))))
should return nil as there is no layer named "Beam Lower" in the drawing

Correct you are...I was using a different drawing when I was checking it.  Using the one I posted the above returns 0" as you say (because of no layer of that name).  Using the above code with "beam skid" appears to return the correct value so perhaps the test drawing I was using is corrupted in some way.  Also using the Select code with the "beam lower" appears to be returning the correct value for the skid, filtering out the beam for the supports and rack and filters out all of the angle iron.

I still need to double check the total length of the skid but think the returned value is correct.  I'm liking this thing a lot...
Title: Re: 3D Solid Total Length
Post by: Kerry on August 12, 2007, 11:40:53 PM
Just for fun ..

Add a diagonal brace onto one of the the end bays an let us know if it returns the value you expect.
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 12:05:04 AM
Just for fun ..

Add a diagonal brace onto one of the the end bays an let us know if it returns the value you expect.

Well, yes and no...I've added two angle iron braces and as long as they are in the Z plane the value returned is accurate...23'-11 19/64".  When I use them as diagonal braces (angle a bit greater apx 50) then the value returned is...19'-7 23/32".  So it really doesn't seem to work well with diagonal solids.  :cry:
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 12:33:22 AM
I still need to double check the total length of the skid but think the returned value is correct.  I'm liking this thing a lot...

"Beam Skid"...Actual measurement 252'-9 1/4"  "Beam Skid"...VLisp Routine measurement 252'-9 1/4"
Perfect... :-D
Guess I'll just have to measure the diagonal bracing like I always have...manually, but this is so much nicer already.  Off to set up a quick way to set the layers...thinking about setting the desired layer current and then using clayer to pop in an acronym in the lisp...comments?  The sun has been down a long time here so I think I'll take a bit of a nap.
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 10:28:23 AM
Hi Scrutch , if I do a selection set for 3D at the "Beam Rack"  layer it have 9 items , one repeated as it show 8 .



Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 10:42:38 AM
Hi Scrutch , if I do a selection set for 3D at the "Beam Rack"  layer it have 9 items , one repeated as it show 8 .

 :oops:
My bad...the second cross beam from the upper end is actually two beams.  The eyeball will count 8 items but there are really 9 items.  Thanks for the catch as this skid needs to go out soon.  I haven't confirmed the uprights or the rack yet but the beam and angle are confirmed.  Very nice routine...thanks.

I am having a couple of problems though...I set the beam pick thus:
    (setq pik (getvar "clayer"))
    (setq 3dss-ALL  (ssget "X" (list (cons 8 pik))))
If I set the current layer to one that has no solids on it I get some weird results.  I need to go back through the code and see what I've done.  Did a lot of clean up for the permanent code and may have deleted something that was much more important than I thought.  Any thoughts on an accurate way to do diagonal measurements?
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 10:45:04 AM
the beam and angle are confirmed.
What I meant to say is the Beam Skid and Angle Skid are confirmed.
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 11:04:07 AM
I am having a couple of problems though...I set the beam pick thus:
    (setq pik (getvar "clayer"))
    (setq 3dss-ALL  (ssget "X" (list (cons 8 pik))))
If I set the current layer to one that has no solids on it I get some weird results.

Oki...I went back to the original posted code and this is all I added or changed.
    (setq pik (getvar "clayer")) ;_added this line
    (setq 3dss-ALL  (ssget "X" (list (cons 8 pik)))) ;_changed this line
.........
(alert (strcat " Total Length of " pik " = "(rtos sum))) ;_changed this line

Now if I set the current layer to Coord Skid the value returned is:
Total Length of Coord Skid = 14'-7 21/64
There are not any solids on this layer, just 4 lines, 4 circles and 8 text strings.  Any ideas on this?  Must have something to do with this guy.     (setq 3dss-ALL  (ssget "X" (list (cons 8 pik))))
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 12:24:22 PM
I am having a couple of problems though...I set the beam pick thus:
    (setq pik (getvar "clayer"))
    (setq 3dss-ALL  (ssget "X" (list (cons 8 pik))))
If I set the current layer to one that has no solids on it I get some weird results.

This is what I'm trying to do to verify that the layer has 3dSolids,
    (setq pik (getvar "clayer"))
      (if pik (= '((0 . "3DSOLID"))))
    (setq 3dss-ALL  (ssget "X" (list (cons 8 pik))))
      ) ;_if
but get an error as soon as the routine is loaded.
error: bad argument type: VLA-OBJECT nil
Thought I was going to fish but I must have left all my bait behind and perhaps a bit of my gray matter as well.
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 12:26:41 PM
Firts use this
Code: [Select]
(vl-load-com)
 (setq adoc
(vla-get-activedocument
   (vlax-get-acad-object)
)
  );_ adoc is the current DWG
)



Code: [Select]
(setq 3d-ent (entsel "select a 3d  "))
  (setq lay-name (cdr(assoc 8(entget(car 3d-ent)))))

you pick on a 3d a, and get the layer
Code: [Select]
then


(setq 3dss (ssget "X" (list(cons  0  "3DSOLID")(cons 8  lay-name ))))
  (setq 3d-qty (sslength 3dss))
and you will get all solids in such layer
 3d-qty will give you how many 3d are on it , just o check by sight

after it

Code: [Select]
(setq sum 0)
(setq cnt 0)
(setq 3d-obj ( vla-get-activeselectionset adoc ));_ all the solids at the dwg as OBJECTS
(vlax-for 3d 3d-obj;_ same as foreach but for OBJ
  ; you do not need to check for a solid as the ssget"X" get 3dsolids only
;;;       
  ;;(setq 3d (vla-item 3d-obj 0)); used to get the first obj , just to test de following part
        (vla-getboundingbox 3d 'minpoint 'maxpoint)
        (setq box (mapcar '- (vlax-safearray->list maxpoint)
        (vlax-safearray->list minpoint)))
        (setq lenth (apply 'max box))
(setq sum(+ sum lenth))
(setq cnt(+ cnt 1))
sum
  );_ vlax-for


and at last

Code: [Select]
(alert (strcat " Total Length of Solid = at " layer-name  (rtos sum  ) "  \n  in    " (itoa cnt  )"   pieces"))


Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 01:25:15 PM
Firts use this
........
and at last

Code: [Select]
(alert (strcat " Total Length of Solid = at " layer-name  (rtos sum  ) "  \n  in    " (itoa cnt  )"   pieces"))

Can't get this guy to run for me.  First off I changed the above line of code to  lay-name  to match the setq guy.
Immediately after I load the routine it prompts me to select a 3d (not sure what causes the routine to start running before I type the name, seen it before but don't remember at the moment what the caused this.  As soon as I pick a 3d it gives me this error:
; error: bad argument type: VLA-OBJECT nil
Then if I type the routine name  Solxt  it returns this:
#<VLA-OBJECT IAcadDocument 0101cf6c>
I really appreciate all the time you are putting into this routine for me.

Code: [Select]
(defun C:SolxT ( /
3D-OBJ
3DSS
ADOC
BOX
CNT
LENTH
MAXPOINT
MINPOINT
;;SUM
)
  (vl-load-com)
 (setq adoc
(vla-get-activedocument
   (vlax-get-acad-object)
)
  );_ adoc is the current DWG
)
(setq 3d-ent (entsel "select a 3d  "))
  (setq lay-name (cdr(assoc 8(entget(car 3d-ent)))))
(setq 3dss (ssget "X" (list(cons  0  "3DSOLID")(cons 8  lay-name ))))
  (setq 3d-qty (sslength 3dss))

(setq sum 0)
(setq cnt 0)
(setq 3d-obj ( vla-get-activeselectionset adoc ))
(vlax-for 3d 3d-obj
        (vla-getboundingbox 3d 'minpoint 'maxpoint)
        (setq box (mapcar '- (vlax-safearray->list maxpoint)
        (vlax-safearray->list minpoint)))
        (setq lenth (apply 'max box))
(setq sum(+ sum lenth))
(setq cnt(+ cnt 1))
sum
  );_ vlax-for
(alert (strcat " Total Length of Solid = at " lay-name  (rtos sum  ) "  \n  in    " (itoa cnt  )"   pieces"))
  (princ)
)

;|«Visual LISP© Format Options»
(120 2 40 0 nil "end of " 100 20 1 2 0 T nil nil T)
;*** DO NOT add text below the comment! ***|;
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 01:37:36 PM
seem to be you did not pick on a 3d . I will fix it and sen a new way .
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 01:51:13 PM
see attached  , hope it work as you need , check if there are no duplicates.


Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 02:49:19 PM
see attached  , hope it work as you need , check if there are no duplicates.

Ahhh...works well, what little bit I've tried it...error message if I pick on a layer that doesn't have any 3d's on it and returns the value if it is a 3d layer.  Thanks ever so much Devitg.
Yes, on the error message I posted before that was a pick on a non 3d layer...the 3d layer returned this:
select a 3d
; error: no function definition: VLA-GET-ACTIVESELECTIONSET

I did try this one on two pieces of angle iron I am using for bracing...both of the are 12'-0" so the total would be 24'-0".  The routine returns a value of 17'-1 55/64".  The piece count is correct.  Can you think of a way that the bracing could accurately be measured as well.  If not this is still going to make life much easier.

Off to make this guy print to a file for my bill of materials and do some serious testing with it.
Thanks again and have a GREAT DAY.
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 03:14:16 PM
Please post it, the dwg with bracing , I will check it 
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 03:21:50 PM
Please post it, the dwg with bracing , I will check it

I've just thrown a couple of pieces of angle in here on the very lower end, not really tied to anything but each piece is 12'-0" in lenght.  Layer = Angle Brace.
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 04:01:54 PM
It is because the bounding box is based on the actual wcs .
I was thinking in a option to get length , to get the volume and according to section area to get it.
Of course it will need to add to the layer name the section area value like "Angle Brace - 0.9375"  so when you pick on it the area can be get and then do the calcs to get the length , of course there will need to add some volume as the bar´s end are cut to fit the others ,
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 04:17:16 PM
It is because the bounding box is based on the actual wcs .
I was thinking in a option to get length , to get the volume and according to section area to get it.
Of course it will need to add to the layer name the section area value like "Angle Brace - 0.9375"  so when you pick on it the area can be get and then do the calcs to get the length , of course there will need to add some volume as the bar´s end are cut to fit the others ,

Sounds pretty complex to me and may not be worth the effort.  The braces are not always at the same angle so the multiplier would keep changing...right?  Perhaps someone that had as many or more braces as I have horizontal, vertical and perpendicular 3d's would greatly benefit from this.  As for pleasing me, no more bracing than I have I can still measure them manually.  Done it for several years now so a few more won't kill me.

Would like to report that ALL of the normal 3d's on all the layers agree mathematically with the routines calculations.  Course the routine is about 30x faster than doing it mathematically.  Life is good...Thanks again for all the help.
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 04:27:57 PM
It does not matter the angle , as it will get the volume

by vla function

Code: [Select]
(setq volumen (vla-get-volume 3d))
Title: Re: 3D Solid Total Length
Post by: Scrutch on August 13, 2007, 04:31:13 PM
It does not matter the angle , as it will get the volume

by vla function

Code: [Select]
(setq volumen (vla-get-volume 3d))

Well, if it's not a large problem for you it's fine with me to make it work, just tell me how I can help and what to do.
Title: Re: 3D Solid Total Length
Post by: DEVITG on August 13, 2007, 05:03:38 PM
Just rename the layers to have the area of each profile as

"Angle Brace-0.9375"

You can get the section of each area from tables.-

Then It will be easy to get it.-

The minus sign  [ - ] is to be used as the spliter of the  lay-name  text.-

You must state how much is the % lost at the cuts made on bar´s ends.
Maybe it is not more than 5 % .