Yes you can use the Transform.Origin of the direct shape instance when you use instance/type approach rather than just creating a isolated direct shape.
Using type/instance approach with DirectShapeLibrary or DirectShape.CreateElementInstance also allows type category bound parameters to be added in the project to the direct shape type.
Public Function Obj_211003a(commandData As ExternalCommandData, ByRef message As String, elements As ElementSet) As Result
Dim uidoc = commandData.Application.ActiveUIDocument
Dim IntDoc = uidoc.Document
Dim Pt As New XYZ(0, 0, 0)
Dim Unit As Double = 0.5
Dim Fr As New Frame(Pt, XYZ.BasisX, XYZ.BasisY, XYZ.BasisZ)
Dim LN As Line = Line.CreateBound(Pt - (XYZ.BasisZ * Unit), Pt + (XYZ.BasisZ * Unit))
Dim Pl As Plane = Plane.CreateByNormalAndOrigin(XYZ.BasisY, Pt)
Dim Arc As Arc = Arc.Create(Pl, Unit, 0, Math.PI)
Dim Cl As New CurveLoop
Cl.Append(LN)
Cl.Append(Arc)
Dim CLa = New CurveLoop() {Cl}.ToList
Dim Ob As Solid = GeometryCreationUtilities.CreateRevolvedGeometry(Fr, CLa, 0, 2 * Math.PI)
Using Tr As New Transaction(IntDoc, "DS")
If Tr.Start = TransactionStatus.Started Then
Dim DSt As DirectShapeType = DirectShapeType.Create(IntDoc, "Sphere", New ElementId(BuiltInCategory.OST_GenericModel))
DSt.AppendShape(New GeometryObject(0) {Ob}.ToList)
Dim Location As New XYZ(10, 15, 20)
Dim T As Transform = Transform.CreateTranslation(Location)
Dim DSL = DirectShapeLibrary.GetDirectShapeLibrary(IntDoc)
DSL.AddDefinitionType("Sphere_AA", DSt.Id)
'Contains geometry transform with origin
Dim LL As List(Of GeometryObject) = DirectShape.CreateGeometryInstance(IntDoc, "Sphere_AA", T)
Dim DSX = DirectShape.CreateElement(IntDoc, New ElementId(BuiltInCategory.OST_GenericModel))
DSX.SetShape(LL)
'This set below is apparently not required but it associates the instance with the type
'Therefore any type parameters added in project to the associated category will be available in the DS type
DSX.SetTypeId(DSt.Id)
Tr.Commit()
End If
End Using
Return Result.Succeeded
End Function
When you extract the geometry of the above shape it will contain a GeometryInstance with Transform.Origin set to 10,15,20 and the symbol geometry will be at 0,0,0.