Author Topic: Trig wieners ...  (Read 7438 times)

0 Members and 1 Guest are viewing this topic.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Trig wieners ...
« Reply #15 on: July 07, 2007, 09:37:36 PM »
.............. The way AutoPlant creates ...............

yep, I've played around with the Com interface .... the one branded ProSteel, when KiwiSoft owned it .. can't imagine it's changed much since Bentley bought them out.
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trig wieners ...
« Reply #16 on: July 07, 2007, 09:40:57 PM »
I've played around with the Com interface .... the one branded ProSteel, when KiwiSoft owned it .. can't imagine it's changed much since Bentley bought them out.

It's still ProSteel / KiwiSoft underneath it all, ergo the PS and Ks_ prefixes ...

Code: [Select]
    ...
    (setq shapeinfo
        (vlax-create-object
            "PSCOMWRAPPER.Ks_ComShapeInfo"
        )
    )
    ...

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trig wieners ...
« Reply #17 on: July 07, 2007, 10:45:18 PM »
After all said and done it distills down to one function:

Code: [Select]
(defun _GetPileCutoffElev ( pile / shapeinfo points result )

    ;;  Caller's responsibility to ensure a valid AutoPlant
    ;;  structural pile object is passed as well as ensuring
    ;;  AutoPlant structural enabler arx/dbx files are loaded
    ;;  prior to calling this function or splat: rake in face.
    ;;  ---------------------------------------------------
    ;;  Thanks to Kerry Brown for distilling assistance.

    (setq shapeinfo
        (vlax-create-object
            "PSCOMWRAPPER.Ks_ComShapeInfo"
        )
    )

    (vlax-invoke
        shapeinfo
       'SetObject
        pile
    )

    (vlax-invoke
        shapeinfo
       'Getinfo
    )

    (setq result

        (if
       
            ;;  determine type of pile ...

            (<
                (apply 'distance
                    (mapcar
                       '(lambda (p) (list (car p) (cadr p)))
                        (setq points
                            (mapcar
                               '(lambda (x) (vlax-get shapeinfo x))
                               '(MidLineStart MidLineEnd)
                            )
                        )

                    )
                )
                0.001
            )

            ;;  it's a normal pile, get the highest z value   

            (apply 'max (mapcar 'last points))

            ;;  it's a battered pile, get the normalized z value
            ;;           
            ;;  see image at:
            ;;           
            ;;      http://www.theswamp.org/screens/mp/batteredpile.png
            ;;           
            ;;  ASCII representation is idealized elevation, side ab
            ;;  is the CL of the pile; p1 = point a, p2 = point b.
            ;;
            ;;             elev               
            ;;            ------ + b (p2)
            ;;                  /|\
            ;;                 / | \     
            ;;                /  |  \     result
            ;;               / e +---+ d --------
            ;;              /    |
            ;;      (p1) a +-----+ c
            ;;
            ;;  Angles in representation are not proportionate: Angle
            ;;  a-b-d = 90, whereas angle e-b-d equals angle c-a-b.
            ;;
            ;;  Side bd is the radius of the pile.
            ;;
            ;;  Elevation at point 'e' is the desired result.

            (   (lambda ( p1 p2 radius)
                    (-  (apply 'max (mapcar 'last (list p1 p2)))
                        (*  radius
                            (/  (distance p1 (list (car p2) (cadr p2)))
                                (distance p1 p2)
                            )
                        )
                    )
                )
                (car points)   
                (cadr points)
                (/ (vlax-get pile 'Width) 2.0)
            )   
        )   
    )               

    (vlax-release-object shapeinfo)

    result

)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Trig wieners ...
« Reply #18 on: July 08, 2007, 06:29:27 AM »
interesting word, 'weiner' 'wiener'
« Last Edit: July 08, 2007, 07:37:56 AM by Kerry Brown »
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trig wieners ...
« Reply #19 on: July 08, 2007, 10:31:34 AM »
interesting word, 'weiner' 'wiener'

Steady fella, I meant it in the context of 'HotDogs'; i.e. "someone who
performs dangerous stunts to attract attention to himself". Not #3.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

CADaver

  • Guest
Re: Trig wieners ...
« Reply #20 on: July 08, 2007, 12:52:08 PM »
haven't looked at the code, but you do realize that the elevation of point D is the same as point E?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Trig wieners ...
« Reply #21 on: July 08, 2007, 12:55:31 PM »
you do realize that the elevation of point D is the same as point E?

I do. Are you saying you know a more efficient way than ...

Code: [Select]
(-  (apply 'max (mapcar 'last (list p1 p2)))
    (*  radius
        (/  (distance p1 (list (car p2) (cadr p2)))
            (distance p1 p2)
        )
    )
)

... to get the cutoff elevation given only (3D) points A, B and the pile radius?



{ Subtitle: If so please share. }

:)
« Last Edit: July 08, 2007, 02:39:33 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst