Hello,
My dgn files attached. The ref file is openplant imodel.
And my codes are attached also:
Sub ScanCallout(MyAtt) ' As Attachment)
Dim MyAttachment As Attachment
Dim oScan As ElementScanCriteria
Dim MyTrns As Transform3d
Dim oEnum As ElementEnumerator
Dim MyCell As CellElement
Set oScan = New ElementScanCriteria
Set oEnum = MyAtt.Scan(oScan)
While oEnum.MoveNext
Select Case oEnum.Current.Type
Case msdElementTypeCellHeader
Set MyCell = oEnum.Current
Select Case OPMType(MyCell)
Case "PIPE"
Debug.Print MyCell.Range.High.x
MyTrns = MyAtt.GetReferenceToMasterTransform
Debug.Print Point3dFromTransform3dTimesPoint3d(MyTrns, MyCell.Range.High).x
Case Else
End Select
End Select
Wend
For Each MyAttachment In MyAtt.Attachments
Call ScanCallout(MyAttachment)
Next
End Sub
Sub PlaceDim()
Call ScanCallout(ActiveModelReference)
End Sub
Function OPMType(OPMAttElement) As String
OPMType = "UNKNOWN"
On Error Resume Next
Dim oPh As PropertyHandler
Dim PropertyAccessString() As String
Set oPh = CreatePropertyHandler(OPMAttElement)
PropertyAccessString = oPh.GetAccessStrings
Select Case UBound(PropertyAccessString) - LBound(PropertyAccessString)
Case 24
If PropertyAccessString(0) = "DESIGN_STATE" Then
OPMType = "AREA"
Exit Function
End If
If PropertyAccessString(10) = "DESIGN_STATE" Then
OPMType = "UNIT"
Exit Function
End If
Case 31
OPMType = "SERVICE"
Exit Function
Case 33
OPMType = "ISO"
Exit Function
Case 72
OPMType = "SEG"
Exit Function
Case 78
OPMType = "PIPELINE"
Exit Function
Case Else
oPh.SelectByAccessString ("EC_CLASS_NAME")
OPMType = oPh.GetValue
Exit Function
End Select
End Function
(Please visit the site to view this file)
My purpose is to place dimension automatically. My steps are below:
1. Scan all the reference to get OPM elements(All OPM elements are cell)
2. Get points of scaned OPM elements. Store the points which I want to dimensioned.
3. Get the coordinates of master file. Step 2 get the original coordinates in ref file.
4. Place dimension in master file according to points on step 3. The dimension value must be the value in ref file. It should be able to calculated from step 2.
I just need the elements inside the sheet. For those elements partially show in the sheet, I need the point at the edge of the callout. No idea how to do it now. Now I can get all the elements in the ref file, but I don't know the callout range, so I don't know which elements are in the callout.
I want to do it automatically, so I don't consider any maually operation( such as place fence) at the moment.
I'm using MS V8i 08.11.09.459 & MVBA.
Thanks a lot! And I apologize for misunderstanding before.