Hello @Mustafa.Salaheldin
I think you have just wrongly assumed the other two points of the bounding box i.e. two points represent more than one unique rectangle. If you get all four points of the bounding box corners on plan without transformation and then transform them you can draw lines between them as below. I think what confused me when I looked at this originally was the double door families. Note however that in the case of the sample file all doors were parallel with the internal coordinate system. If your door instances were rotated (hosted on a non vertical or horizontal directional wall) the bounding box would still be orientated to the internal system not rotated with the door. So that aspect may add a layer of confusion, you would have to orientate the bounding box using the door instance transform first. This may not be possible actually since original two points circumscribe door with a box parallel to internal system, so when rotated this would be meaningless. In such a circumstance you likely need to build your own bounding box within the new orientation by looking at max/mins you get for the geometry in the new system.
You can't get the rotation of a scope box but if you set a view to one then you can compare 1,0,0 to the right direction of the view to get scope box rotation. This should not be required here because the view right direction is used so transform should already incorporate it. Useful to know however that the orientation of a scope box can be found this way (using one of those transaction rollback workflows). The alternative may be to interrogate the geometry of the scope box to find direction of lines around the scope box bounding box centre (for the top or bottom rectangle of the cube). Although you likely couldn't get a full roation between 0 and 2Pi for this due to symmetry. Depends on how geometry of cube is constructed in terms of line directions there may be some non symmetrical patterm of this (looking at all 12 lines etc.).
Dim Dr As Element = Doors(DRi)
Dim BB As BoundingBoxXYZ = Dr.BoundingBox(V)
Dim BL As New XYZ(BB.Min.X, BB.Min.Y, 0)
Dim BR As New XYZ(BB.Max.X, BB.Min.Y, 0)
Dim TL As New XYZ(BB.Min.X, BB.Max.Y, 0)
Dim TR As New XYZ(BB.Max.X, BB.Max.Y, 0)
BL = T.Inverse.OfPoint(BL).Multiply(1 / Scale) + Offset
BR = T.Inverse.OfPoint(BR).Multiply(1 / Scale) + Offset
TL = T.Inverse.OfPoint(TL).Multiply(1 / Scale) + Offset
TR = T.Inverse.OfPoint(TR).Multiply(1 / Scale) + Offset
Dim LN_B As Line = Line.CreateBound(BL, BR)
Dim LN_R As Line = Line.CreateBound(BR, TR)
Dim LN_T As Line = Line.CreateBound(TR, TL)
Dim LN_L As Line = Line.CreateBound(TL, BL)
Doc.Create.NewDetailCurve(AcView, LN_B)
Doc.Create.NewDetailCurve(AcView, LN_R)
Doc.Create.NewDetailCurve(AcView, LN_T)
Doc.Create.NewDetailCurve(AcView, LN_L)