03-02-2018
06:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
03-02-2018
06:46 AM
@chandra.shekar.g you were thinking the same as I was. I updated my function yesterday morning. This makes sure you get the correct object by combining all centermarks and centerlines. Then I maintain a list of all known center objects in a shared variable "shtCenterObjsKnown". Then I find my object by process of elimination.
In my drawings, I shouldn't have more than 50 center objects so this is manageable.
@chandra.shekar.g would the Ideastation be the best place to request an enhancement to the API?
Function CreateCenterObj(Sht As Sheet, dv As DrawingView, occ As Object, FeatureName As String) As Object Dim docDesc As DocumentDescriptor = dv.ReferencedDocumentDescriptor Dim Doctype As DocumentTypeEnum = docDesc.ReferencedDocumentType ''get object Select True Case FeatureName.Contains("Plane") If Doctype = DocumentTypeEnum.kPartDocumentObject includeObj = occ.Definition.WorkPlanes(FeatureName) Else ''assembly, so GET PROXY OF OCCURRENCE includeObj = ASI_.getWorkPlaneProxy(occ, FeatureName) End If Case FeatureName.Contains("Axis") If Doctype = DocumentTypeEnum.kPartDocumentObject includeObj = occ.Definition.WorkAxes(FeatureName) Else ''assembly, so GET PROXY OF OCCURRENCE includeObj = ASI_.getWorkAxisProxy(occ, FeatureName) End If Case FeatureName.Contains("Point") If Doctype = DocumentTypeEnum.kPartDocumentObject includeObj = occ.Definition.WorkPoints(FeatureName) Else ''assembly, so GET PROXY OF OCCURRENCE includeObj = ASI_.getWorkPointProxy(occ, FeatureName) End If End Select dv.SetIncludeStatus(includeObj, True) '''GREAT, I made a centermark or centerline but now I have to find it...ahhhhh ''Build collection of ALL centermarks and centerlines on sheet Dim shtCenters As ObjectCollection = ThisServer.TransientObjects.CreateObjectCollection shtCenters.clear 'reset just to be sure For Each CL As Centerline In Sht.Centerlines shtCenters.Add(CL) Next For Each CM As Centermark In Sht.Centermarks shtCenters.Add(CM) Next ''remove known center objects from list of ALL centermarks and centerlines on sheet For Each cObjKnown In shtCenterObjsKnown shtCenters.RemoveByObject(cObjKnown) Next ''shtCenters.count should be 1 If shtCenters(1).ModelWorkFeature Is includeObj And shtCenters.count = 1 shtCenterObjsKnown.Add(shtCenters(1)) ''add to list of known newCntr = shtCenters(1) 'define as new object found End If Return newCntr End Function
Josh Hunt