Author Topic: Math - 3D Solid Challenge  (Read 6937 times)

0 Members and 1 Guest are viewing this topic.

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Math - 3D Solid Challenge
« on: January 29, 2008, 10:02:40 AM »
Anybody up for a 3D math challenge?  What I need to do is locate 3 blocks in 3D Space, and Connect them with 2 pieces of 3d "pipe"  Should be easy enough with the math, its the connecting Im having problems with.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #1 on: January 29, 2008, 10:06:39 AM »
The blocks needed are here as well
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #2 on: January 29, 2008, 10:08:19 AM »
Now here is the challenge, Write a routine, preferable in VBA to accommodate varying C.L. to C.L. (centerline to centerline) heights.  the picture shown is a 6 foot separation
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #3 on: January 29, 2008, 03:07:22 PM »
Do the angles of the 'T' pieces remain the same? this means the centre of the 2 bottom pieces will vary then yes?

If this is the case you need to create 2 vectors from the pipes, scale them to suit the changed height between the centres.
I'll knock up a quick piccy when I get to work and make sure we're on the same page.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #4 on: January 29, 2008, 03:56:23 PM »
The hard part is the inverse matrix in vba for extruding the pipes.

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #5 on: January 29, 2008, 03:59:09 PM »
The angle is always 30degrees b/t the 2 down pipes, the 2 bottom pieces would then have to move to accomodate the height difference.  Also, the blocks I posted can be edited if we need to move the insertion points.  After playing with it today, I ended p moving the ins pt to be more inline with the down pipe.  The problem I ran into was the V-part at the top.  The center of the V-pipes does not go through the center of the top piece, so I am having trouble figuring out how to calc where to go.  Maybe Im just over looking something  simple.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #6 on: January 29, 2008, 04:01:22 PM »
Bryco, I was thinking of using hard-coded numbers from the ins pt of the top piece to get to the location of the pipe start, and then doing the TAN calc based on CL to CL distance to do the extrusion.  Or Im totally in left field
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #7 on: January 29, 2008, 04:02:10 PM »
99.999999% of the time the UCS will be world, and that .0000001% of the time, It wont work anyway.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #8 on: January 29, 2008, 04:03:26 PM »
I was thinking of drawing lines from start to end point for the pipes, and extruding a circle w/ the normal set to the line, the length calced.  Similiar to the horizontal and vertical extrusions you helped me with about a year ago
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #9 on: January 29, 2008, 04:05:10 PM »
Here's the math part anyway (I think :) )
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #10 on: January 29, 2008, 04:10:05 PM »
IRT pipe extrusions, draw the circle/s, translate to point and set normal to line direction as Duh said and extrude the length of the line. Some calc's would also be need to located the 'actual' sp and ep of the pipe as it won't be the full length of the line.

To derive the cot and csc use these -

csc = 1/sinA
cot = 1/tanA

plug 'em in and away you go ;)
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #11 on: January 29, 2008, 04:11:33 PM »
Mick, here is a pic showing the lower pieces moving inward to accomodate the shorter distance.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #12 on: January 29, 2008, 04:18:04 PM »
Good, that makes it easy then.
The length of the line to pnt1 in my piccy = 1/sinA x H
pnt1.x = -1/tanA x H
pnt1.y = -H


IRT to anything other than wcs, always do the modeling in wcs then xform into place, it's a lot easier.
« Last Edit: January 29, 2008, 04:41:28 PM by MickD »
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #13 on: January 29, 2008, 04:50:10 PM »
IRT ?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #14 on: January 29, 2008, 04:51:35 PM »
In Regards To :)
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #15 on: January 29, 2008, 04:53:37 PM »
Thats what I thought, but google didn't even know
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #16 on: January 29, 2008, 04:53:58 PM »
what about the fact that the centerlines are off of the center of the upper part?
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

Cathy

  • Bull Frog
  • Posts: 251
Re: Math - 3D Solid Challenge
« Reply #17 on: January 29, 2008, 05:04:44 PM »
Would putting some workpoints in your blocks help with some of this?  Like a point where the CLs cross, points where the pipes connect?

IRT -- odd I always use WRT (with respect to).  Is that just a difference is Aussie English and American English?  Or is just a difference in disciplines? 

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #18 on: January 29, 2008, 05:08:15 PM »
I was thinking of calcing the workpoint in code, and then moving down and to the left/right from there to start the line.  If you look at the first pic, you can see some cross's inside the pipe, that is the start/stop point for the vertical anlge of pipe
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #19 on: January 29, 2008, 05:15:56 PM »
>>what about the fact that the centerlines are off of the center of the upper part?

The angle is still the same so I'd translate the pipe 11/16 to the left and the bottom T the amount of the offset from insert point to the left, repeat on right side.

I'd have a go at this but I'm busy with something else at the moment but here's the steps I would take using the math I posted earlier -

Calc the pipe lengths and pnt1 on the left side
Insert the top pipe at origin
Insert the left bottom T at pnt1 and translate it the offset amount to the left
Extrude the pipe, translate it to the origin and the angle then translate it left the top T offset amount
(and along the line a bit if needed to clear cross pipe as it's shorter than the actual line length)
Copy and mirror over top T c.l. for right side.

If I get time later I'll code something up.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #20 on: January 29, 2008, 05:22:00 PM »
thanks
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #21 on: January 30, 2008, 10:55:23 AM »
I had some success with below code.
To the apex bock I added 2 regions on defpoints that are positiioned where you have the lines.
These regions are copied from the block itself then tranlated to the blockrefs position.
Then extruded.

Code: [Select]
Sub Cmd()

    Dim Ent As AcadEntity
    Dim B As AcadBlock
    Dim Br As AcadBlockReference
    Dim P, m, Ret
    Dim Ms As AcadBlock
    Dim Obj(0) As Object
    Dim C1 As AcadCircle, C2 As AcadCircle
    Dim R1 As AcadRegion
    Dim sBlock As String
    Dim Dist As Double, Ht As Double
    Dim Util As AcadUtility
   
    Set Util = ThisDrawing.Utility
    Set Ms = ThisDrawing.ModelSpace
    sBlock = "5020760"
    Util.GetEntity Ent, P, "Pick the 5020"
    If Not TypeOf Ent Is AcadBlockReference Then Exit Sub
    If Not Ent.Name = sBlock Then Exit Sub
    Set Br = Ent
    Set B = ThisDrawing.Blocks(sBlock)
    For Each Ent In B
        If TypeOf Ent Is AcadRegion Then
        Set Obj(0) = Ent
            Ret = ThisDrawing.CopyObjects(Obj, Ms)
            Set R1 = Ret(0)
            R1.Layer = "0"
            R1.Color = 2
            Exit For
        End If
    Next Ent
    Dist = Util.GetDistance(, "Centerline distance")
    If Dist < 17.0855 Then
        MsgBox ("Distance must be larger than 17")
        Exit Sub
    End If
    Ht = (Dist - 17.0855) / Cos(15 / 180 * PI) + 4
    m = BlockRefMatrix(Br)
    m = InverseMatrix(m)

    R1.TransformBy (m)
    Dim Tube As Acad3DSolid
    Set Tube = Ms.AddExtrudedSolid(R1, Ht, 0)
   
End Sub



Function BlockRefMatrix(oBref As AcadBlockReference) As Variant

    Dim V, m(3, 3) As Double, M1, M2
    Dim j As Integer
    Dim X, Y, Z, ins
    Dim Rot As Double
   
    Rot = oBref.Rotation
    Z = oBref.Normal
    V = GetOcsFromNormal(Z)
    X = V(0): Y = V(1)
    PrintP X
    PrintP Y
    ins = oBref.InsertionPoint
   
    M1 = RotZ(-Rot)
    For j = 0 To 2
        m(0, j) = X(j)
        m(1, j) = Y(j)
        m(2, j) = Z(j)
    Next j
    m(0, 3) = -ins(0): m(1, 3) = -ins(1): m(2, 3) = -ins(2)
    m(3, 3) = 1
    'PrintM M
    If Rot = 0 Then
        BlockRefMatrix = m
    Else
        M2 = M4xM4(m, M1)
        PrintM M2
        BlockRefMatrix = M2
    End If
   
   
   
End Function

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #22 on: January 30, 2008, 05:44:32 PM »
I had some success with below code.
To the apex bock I added 2 regions on defpoints that are positiioned where you have the lines.
These regions are copied from the block itself then tranlated to the blockrefs position.
Then extruded.

Great idea Bryco! saves quite a bit of matrix mojo. Perhaps you can put the other bottom blocks in as well as nested in the correct alignment then just translate it along the line vector the given amount after calc'ing with the new height?
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #23 on: January 30, 2008, 08:07:38 PM »
I haven't done much coding for the creation and editing of 3d objects so I tried a circle first, only to find a cylinder doesn't follow a path.
So yes the region saves a bit of matricising (Pres. Bush speak).
After an hour I thought I would have the hard part whooped but alas the correct matrix is eluding me for the funky blocks. (Dang it). Works for the blocks rotated in the same plane.
Mick, I think straight vector math will establish the insertion point of the other blocks and when that is translated using the same magical matrix David can say "Bob's me uncle"

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #24 on: January 30, 2008, 08:12:53 PM »
Do you mean to rotate the bottom T or to mirror it?

To create a mirror matrix you should be able to just negate some the vectors for axes and translation and transformBy.
If you are mirroring over the y axis, negate the x vector for example.

if it's the rotation of the blocks perhaps setting them up in the block drg in the correct location/orientation for simple insert (create a block for left and right say).
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #25 on: January 30, 2008, 08:36:21 PM »
It's even easier, I just noticed that ent's have a Mirror3d method. that may help.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #26 on: January 30, 2008, 09:52:48 PM »
This is what I'm thinking -
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #27 on: January 31, 2008, 12:27:43 AM »
This works, finally. David the last part is mirror3d as Mick suggests.
Transpose rather than inverse threw for a while as usual (More brains reqd.)
There is a weird variety of math used here, but they all relate to normals somewhere.
Code: [Select]
Option Explicit
Const PI As Double = 3.14159265358979


Sub Dav()

    Dim Ent As AcadEntity
    Dim B As AcadBlock
    Dim Br As AcadBlockReference
    Dim P, M, M1, Ret
    Dim Ms As AcadBlock
    Dim Obj(0) As Object
    Dim C1 As AcadCircle, C2 As AcadCircle
    Dim R1 As AcadRegion
    Dim sBlock As String
    Dim Dist As Double, Ht As Double
    Dim Util As AcadUtility
    Dim Zero(2) As Double
   
   
    Set Util = ThisDrawing.Utility
    Set Ms = ThisDrawing.ModelSpace
    sBlock = "5020760"
    Util.GetEntity Ent, P, "Pick the 5020"
    If Not TypeOf Ent Is AcadBlockReference Then Exit Sub
    If Not Ent.Name = sBlock Then Exit Sub
    Set Br = Ent
    Set B = ThisDrawing.Blocks(sBlock)
    For Each Ent In B
        If TypeOf Ent Is AcadRegion Then
        Set Obj(0) = Ent
            Ret = ThisDrawing.CopyObjects(Obj, Ms)
            Set R1 = Ret(0)
            R1.Layer = "0"
            R1.color = 2
            Exit For
        End If
    Next Ent
    Dist = Util.GetDistance(, "Centerline distance")
    If Dist < 17.0855 Then
        MsgBox ("Distance must be larger than 17")
        Exit Sub
    End If
    Ht = (Dist - 17.0855) / Cos(15 / 180 * PI) + 4
    M = BlockRefMatrix(Br)

    M1 = Transpose(M)
    R1.TransformBy (M1)
    Dim Tube As Acad3DSolid
    Set Tube = Ms.AddExtrudedSolid(R1, Ht, 0)
    R1.Delete
   
    Dim width As Double
    Dim inspt(2) As Double
    Dim Br2 As AcadBlockReference
   
    width = (Tan(15 / 180 * PI) * (Dist - 17.0855)) + 4.0682
    inspt(1) = -width: inspt(2) = -Dist
   

    P = TransformPt2(M1, inspt)
    Set Br2 = Ms.InsertBlock(Zero, "5141714", 1, 1, 1, 0)
    Br2.Normal = Br.Normal
    Br2.Rotation = Br.Rotation
    Br2.Move Zero, P
   
End Sub









Function BlockRefMatrix(oBref As AcadBlockReference) As Variant

    Dim V, M(3, 3) As Double, M1, M2
    Dim j As Integer
    Dim X, Y, Z, ins
    Dim Rot As Double
   
    Rot = oBref.Rotation
    Z = oBref.Normal
    V = GetOcsFromNormal(Z)
    X = V(0): Y = V(1)

    ins = oBref.InsertionPoint
   
    M1 = RotZ(-Rot)
    For j = 0 To 2
        M(0, j) = X(j)
        M(1, j) = Y(j)
        M(2, j) = Z(j)
        M(3, j) = ins(j)
    Next j
    M(3, 3) = 1

    If Rot = 0 Then
        BlockRefMatrix = M
    Else
        M2 = M4xM4(M, M1)
        BlockRefMatrix = M2
    End If
   
   
End Function






Function Transpose(Matrix As Variant) As Variant

    Dim iCnt As Integer, jCnt As Integer
    Dim transMat(0 To 3, 0 To 3) As Double
    Dim I As Integer, j As Integer
    iCnt = UBound(Matrix, 1)
    jCnt = UBound(Matrix, 2)
    For I = 0 To iCnt
        For j = 0 To jCnt
            transMat(I, j) = Matrix(j, I)
        Next j
    Next I
    Transpose = transMat
   
End Function



Function TransformPt2(M As Variant, P1 As Variant) As Variant
    Dim I As Integer
    Dim X As Double, Y As Double, Z As Double, d As Double
    Dim P(3) As Double
    Dim P2(2) As Double
    For I = 0 To 2
        P(I) = P1(I)
    Next
    P(3) = 1
   
    For I = 0 To 3
        X = X + P(I) * M(0, I)
        Y = Y + P(I) * M(1, I)
        Z = Z + P(I) * M(2, I)
        d = d + P(I) * M(3, I)
    Next
    P2(0) = X: P2(1) = Y: P2(2) = Z
    TransformPt2 = P2

End Function



Function GetOcsFromNormal(N As Variant) As Variant
    'Arbitrary Axis Algorithm in dxf help
    'N is the normal vector.
    'Wy is the world Y axis, which is always (0,1,0).
    'Wz is the world Z axis, which is always (0,0,1).
    Dim Wy(2) As Double
    Dim Wz(2) As Double
    Dim Nx As Double, Ny As Double
    Dim Ax, Ay, Ocs(1) As Variant
   
    N = NormaliseVector(N)
    Wy(0) = 0: Wy(1) = 1: Wy(2) = 0
    Wz(0) = 0: Wz(1) = 0: Wz(2) = 1
    Nx = N(0): Ny = N(1)
    If (Abs(Nx) < 1 / 64) And (Abs(Ny) < 1 / 64) Then
         'Ax = Wy X N (where “X” is the cross-product operator).
         Ax = Crossproduct(Wy, N)
    Else
         Ax = Crossproduct(Wz, N)
    End If
    Ocs(0) = Ax
 
    Ay = Crossproduct(N, Ax)
    Ocs(1) = Ay
    GetOcsFromNormal = Ocs

End Function



Function RotZ(Ang As Double) As Variant
   'Rotate by an angle around the z axis
    Dim M
    Dim CosAng As Double, sinAng As Double
   
    CosAng = Cos(Ang): sinAng = Sin(Ang)
    M = IDMatrix
    M(0, 0) = CosAng
    M(0, 1) = -sinAng
    M(1, 0) = sinAng
    M(1, 1) = CosAng
     
    RotZ = M

End Function


Function M4xM4(M1, M2) As Variant
    'Matrix x matrix
    Dim M(3, 3) As Double
    Dim I As Integer, j As Integer
    Dim k As Integer
    Dim Sum As Double
   
    For I = 0 To 3
        For j = 0 To 3
            For k = 0 To 3
                Sum = Sum + M1(k, j) * M2(I, k)
            Next k
            M(I, j) = Sum
            Sum = 0
        Next j
    Next I
    M4xM4 = M
   
End Function


Function NormaliseVector(V As Variant) As Variant
    Dim Unit As Double
    Dim Vn(2) As Double
    Unit = Sqr(V(0) * V(0) + V(1) * V(1) + V(2) * V(2))
    Vn(0) = V(0) / Unit: Vn(1) = V(1) / Unit: Vn(2) = V(2) / Unit
    NormaliseVector = Vn
End Function


Function Crossproduct(A, B) As Variant

    Dim Ax As Double, Ay As Double, Az As Double
    Dim Bx As Double, By As Double, Bz As Double
    Dim Unit As Double
    Dim c(2) As Double
    'get CrossProduct
    Ax = A(0): Ay = A(1): Az = A(2)
    Bx = B(0): By = B(1): Bz = B(2)
   
    c(0) = Ay * Bz - Az * By
    c(1) = Az * Bx - Ax * Bz
    c(2) = Ax * By - Ay * Bx
   
    'Convert to unit normal
    Unit = Sqr(c(0) * c(0) + c(1) * c(1) + c(2) * c(2))
    c(0) = c(0) / Unit: c(1) = c(1) / Unit: c(2) = c(2) / Unit
    Crossproduct = c

End Function



Function IDMatrix()
    Dim M(3, 3) As Double
    Dim I As Integer, j As Integer
    M(0, 0) = 1
    M(1, 1) = 1
    M(2, 2) = 1
    M(3, 3) = 1
    IDMatrix = M
   
End Function

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #28 on: January 31, 2008, 12:39:12 AM »
Test dwg.

SEANT

  • Bull Frog
  • Posts: 328
Re: Math - 3D Solid Challenge
« Reply #29 on: January 31, 2008, 07:02:10 AM »
Excellent work once again gentlemen.  A word of caution; if you persist in this development of “one click design creation”, managers may do the work themselves and figure they need CAD techs no longer. :-)

Bryco, I see you’ve expanded the scope of the project to include “other’world’ly” alignments – certainly a welcome inclusion for those of us with chaotic structures.  The one recommendation I would make for dealing with these non-aligned setups, like the block in CmdrduhTest.dwg @ (99.9462, 265.5402, 0.4912), is to switch order of operation from:

Br2.Normal = Br.Normal
Br2.Rotation = Br.Rotation

To:

Br2.Rotation = Br.Rotation 
Br2.Normal = Br.Normal
   
Sean Tessier
AutoCAD 2016 Mechanical

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #30 on: January 31, 2008, 10:44:54 AM »
thanks Sean, re the rotation,normal is there a set of circumstances where that is necessary?

SEANT

  • Bull Frog
  • Posts: 328
Re: Math - 3D Solid Challenge
« Reply #31 on: January 31, 2008, 12:18:34 PM »
I should mention that I'm still using 2004 and may be missing some code changes of the later AutoCAD releases. 

The example I refered to does not align exactly unless those lines are switched.  This example also cause my setup problems.
Sean Tessier
AutoCAD 2016 Mechanical

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #32 on: January 31, 2008, 01:34:08 PM »
Cool, it has no probs in 2008, in 2004 it needs to be written as you say.
There's a mystery.

SEANT

  • Bull Frog
  • Posts: 328
Re: Math - 3D Solid Challenge
« Reply #33 on: January 31, 2008, 06:38:19 PM »
I suppose it is sensible to expect the VBA 3d interface to change with so much extra going on in 2007/2008.  Still, I’ve got to wonder if the boys at Autodesk just like to keep us guessing.  They certainly like to keep us upgrading.

Once again, nice job.
Sean Tessier
AutoCAD 2016 Mechanical

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #34 on: February 01, 2008, 05:23:34 PM »
CmdrDuh-did it do what you wanted?

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #35 on: February 01, 2008, 06:48:07 PM »
I have been gone for 2 days getting my eyes tested.  So I haven't had a chance to try it yet.  Monday I intend to try it.  I'll definetly let you know!!!


Thanks
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #36 on: February 18, 2008, 08:42:02 PM »
Well while it's monday, it is the third monday that has passed.
A bit rude mate.

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #37 on: February 20, 2008, 12:20:32 PM »
Sorry Bryco, I haven't had time to do any programming at work lately.  This week Im home with sick kids, and I have the flu.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

Chuck Gabriel

  • Guest
Re: Math - 3D Solid Challenge
« Reply #38 on: February 20, 2008, 05:13:11 PM »
Sorry Bryco, I haven't had time to do any programming at work lately.  This week Im home with sick kids, and I have the flu.

Get well soon (all of you).

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Math - 3D Solid Challenge
« Reply #39 on: February 20, 2008, 06:49:15 PM »

Rum and limes David  .. rum for you, limes for the kids :-)
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #40 on: February 21, 2008, 04:06:32 PM »
Get well all.

Maverick®

  • Seagull
  • Posts: 14777
Re: Math - 3D Solid Challenge
« Reply #41 on: February 21, 2008, 04:50:43 PM »

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #42 on: February 25, 2008, 09:15:09 AM »
Well I sent the kids back to school today, and Im back at work, so lets see how that bit of code worked.  :-)
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #43 on: February 25, 2008, 09:15:37 AM »

Rum and limes David  .. rum for you, limes for the kids :-)
Just what the Dr. ordered  :-)
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

CmdrDuh

  • Automatic Duh Generator
  • King Gator
  • Posts: 4039
Re: Math - 3D Solid Challenge
« Reply #44 on: February 25, 2008, 10:38:07 AM »
That is awesome!  I just need to work out the mirror part, but that was way cool.  Bryco, I am definetly going to have to study the matrix stuff more, because that was hard core
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second

MickD

  • Gator
  • Posts: 3313
  • (x-in)->[process]->(y-out)
Re: Math - 3D Solid Challenge
« Reply #45 on: February 25, 2008, 03:49:56 PM »
>> I am definitely going to have to study the matrix stuff

Yep, once you understand vectors and matrices (which are just groups/lists of vectors) you can do pretty much anything you like in 3 dimensions ;)
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

Lao Tzu: “To attain knowledge, add things
every day; to obtain wisdom, remove things every day.”

Bryco

  • Water Moccasin
  • Posts: 1849
Re: Math - 3D Solid Challenge
« Reply #46 on: February 25, 2008, 07:58:09 PM »
Glad you like it, David.
C# has all that right at your fingertips but I wonder how difficult it would be to use them without understanding them.
I just wrote a mirror jig for C# and almost laughed when I figured out the jig needed was a rotation jig.
You mirror it once then rotate it where you want (kinda sorta)