RMS Posted June 30, 2010 Share Posted June 30, 2010 Basically I am taking points making lines and closing a loop, then creating a Region. But here is the part I am having trouble with, when trying to Extrude the Region I get nothing. Anyone have a solution or fix? Thanks! Dim acDBObjColl As DBObjectCollection = New DBObjectCollection() Dim myRegionColl As DBObjectCollection = New DBObjectCollection() Dim acRegion As Region ' = CType(myRegionColl(0), Region) Dim solidObj As Solid3d = New Solid3d() ' Create a line acLine = New Line(New Point3d(xStart, yStart, zStart), _ New Point3d(xClose, yClose, zClose)) acLine.SetDatabaseDefaults() acBlkTblRec.AppendEntity(acLine) acTrans.AddNewlyCreatedDBObject(acLine, True) acDBObjColl.Add(acLine) ' make reagion for each layer myRegionColl = Region.CreateFromCurves(acDBObjColl) ' Add the new region object to the block table record and the transaction acRegion = CType(myRegionColl(0), Region) acRegion.ColorIndex = 240 ' = redish acBlkTblRec.AppendEntity(acRegion) acTrans.AddNewlyCreatedDBObject(acRegion, True) 'solidObj.SetDatabaseDefaults() 'solidObj.Extrude(CType(myRegionColl(0), Region), 1.0, 0.0) solidObj.Extrude(acRegion, 1.0, 0.0) ' Add the new object to the block table record and the transaction 'acBlkTblRec.AppendEntity(solidObj) ' end make region Quote Link to comment Share on other sites More sharing options...
SEANT Posted June 30, 2010 Share Posted June 30, 2010 It looks like you’ve tried all the right stuff – is it possible that the problem is before or after the posted code block. For example; does acDBObjColl actually contain a closed set of lines? As a general note, not necessarily related to the problem, appending the region to the blocktable record may not be required. See sample: <CommandMethod("ExLines")> _ Public Sub ExtrudeLine() Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Dim db As Database = ed.Document.Database Dim typeValue() As TypedValue = {New TypedValue(0, "LINE")} Dim selFilter As SelectionFilter = New SelectionFilter(typeValue) Dim selResult As PromptSelectionResult = ed.GetSelection(selFilter) Dim ssLine As SelectionSet = selResult.Value Dim oids() As ObjectId = ssLine.GetObjectIds Using tran As Transaction = db.TransactionManager.StartTransaction Dim oid As ObjectId Dim objcoll As DBObjectCollection = New DBObjectCollection() For Each oid In oids objcoll.Add(CType(tran.GetObject(oid, OpenMode.ForRead), Line)) Next Dim regcoll As New DBObjectCollection Try regcoll = Region.CreateFromCurves(objcoll) Dim sol As Solid3d = New Solid3d() sol.Extrude(CType(regcoll(0), Region), 1.0, 0.0) Dim btr As BlockTableRecord = CType(tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite), BlockTableRecord) sol.SetDatabaseDefaults() btr.AppendEntity(sol) tran.AddNewlyCreatedDBObject(sol, True) Catch ed.WriteMessage(vbCr & "General modeling failure!") Finally regcoll.Dispose() tran.Commit() End Try End Using End Sub Quote Link to comment Share on other sites More sharing options...
RMS Posted June 30, 2010 Author Share Posted June 30, 2010 Great example, this will help me out big time! I did notice that some of my dot operators are different and also I was not using ObjectId. I can run your example fine on my system, so I should be able to implement this into my code with only minor changes. Thank You Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.