Author Topic: 3D Solid Total Length  (Read 10961 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: 3D Solid Total Length
« Reply #15 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"))))
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #16 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...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: 3D Solid Total Length
« Reply #17 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.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #18 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:

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #19 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.

DEVITG

  • Bull Frog
  • Posts: 479
Re: 3D Solid Total Length
« Reply #20 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 .



Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #21 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?

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #22 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.

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #23 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))))

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #24 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.

DEVITG

  • Bull Frog
  • Posts: 479
Re: 3D Solid Total Length
« Reply #25 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"))


Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #26 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! ***|;

DEVITG

  • Bull Frog
  • Posts: 479
Re: 3D Solid Total Length
« Reply #27 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 .
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

DEVITG

  • Bull Frog
  • Posts: 479
Re: 3D Solid Total Length
« Reply #28 on: August 13, 2007, 01:51:13 PM »
see attached  , hope it work as you need , check if there are no duplicates.


Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Scrutch

  • Guest
Re: 3D Solid Total Length
« Reply #29 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.