Search the Community
Showing results for tags 'regions'.
-
INTERSECT command for more than two regions?
eyeofnewt555 posted a topic in AutoLISP, Visual LISP & DCL
Hey guys! If I had 3 regions like the picture, I'd like to be able to get the 2 intersecting regions (without doing them separately). Right now, I'm just getting errors Side request--a LISP that uses INTERSECT without deleting the original regions (similar to this lisp for the SUBTRACT command, or this lisp that does it for polylines rather than regions) Thanks! -
Looking for a solution to search thousands of dwg's to see if they have a region in them. And if so display this list or save the list for later use.
-
:?Good Day Struggling a little with some code to create a region of various items: Code gives exception on the Red Highlited line: [size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Using[/color][/size][/color][/size][size=2] acTrans [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Autodesk.AutoCAD.DatabaseServices.Transaction = acCurDb.TransactionManager.StartTransaction() [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] acBlkTbl [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Autodesk.AutoCAD.DatabaseServices.BlockTable acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] acBlkTblRec [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Autodesk.AutoCAD.DatabaseServices.BlockTableRecord acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] acDBObjCol [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] DBObjectCollection = [/size][size=2][color=#0000ff][size=2][color=#0000ff]New[/color][/size][/color][/size][size=2] DBObjectCollection() acDBObjCol.Add(Line1) acDBObjCol.Add(Line2) acDBObjCol.Add(Line3) acDBObjCol.Add(Line4) acDBObjCol.Add(Line5) acDBObjCol.Add(Line6) MsgBox(Line1.EndPoint.X) [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] myRegionCol [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] DBObjectCollection = [/size][size=2][color=#0000ff][size=2][color=#0000ff]New[/color][/size][/color][/size][size=2] DBObjectCollection() [color=red]myRegionCol = Autodesk.AutoCAD.DatabaseServices.Region.CreateFromCurves(acDBObjCol)[/color] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] acRegion [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Autodesk.AutoCAD.DatabaseServices.Region = myRegionCol(0) acBlkTblRec.AppendEntity(acRegion) acTrans.AddNewlyCreatedDBObject(acRegion, [/size][size=2][color=#0000ff][size=2][color=#0000ff]True[/color][/size][/color][/size][size=2]) [/size][size=2][color=#0000ff][size=2][color=#0000ff]End[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Using [/color][/size][/color][/size][size=2][/size][size=2][color=#0000ff][size=2][color=#0000ff]Catch[/color][/size][/color][/size][size=2] ex [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Exception MsgBox([/size][size=2][color=#a31515][size=2][color=#a31515]"Error"[/color][/size][/color][/size][size=2]) [/size][size=2][color=#0000ff][size=2][color=#0000ff]End[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Try [/color][/size][/color][/size] The Lines Are cteated with this Public Function: "Friend Function DrawLine" which returns the line. Lines Generated as such: " Line1 = DrawLine(PntSt, ModDrawLine.DTR(AngLine), LineLng)" [size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Friend[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Function[/color][/size][/color][/size][size=2] DrawLine([/size][size=2][color=#0000ff][size=2][color=#0000ff]ByVal[/color][/size][/color][/size][size=2] startPoint [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Point3d, [/size][size=2][color=#0000ff][size=2][color=#0000ff]ByVal[/color][/size][/color][/size][size=2] angle [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Double[/color][/size][/color][/size][size=2], [/size][size=2][color=#0000ff][size=2][color=#0000ff]ByVal[/color][/size][/color][/size][size=2] length [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Double[/color][/size][/color][/size][size=2]) [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Line [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] acDoc [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Document = Application.DocumentManager.MdiActiveDocument [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] acCurDb [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Database = acDoc.Database acDoc.LockDocument() [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] id [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] ObjectId [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] line [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Line = [/size][size=2][color=#0000ff][size=2][color=#0000ff]Nothing [/color][/size][/color][/size][size=2][/size][size=2][color=#0000ff][size=2][color=#0000ff]Using[/color][/size][/color][/size][size=2] db [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Database = HostApplicationServices.WorkingDatabase() [/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] endpoint [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Point3d = ModDrawLine.PolarPoint(startPoint, angle, length) startPoint = ModDrawLine.TransformByUCS(startPoint, db) endpoint = ModDrawLine.TransformByUCS(endpoint, db) [/size][size=2][color=#0000ff][size=2][color=#0000ff]Using[/color][/size][/color][/size][size=2] tr [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Transaction = db.TransactionManager.StartTransaction [/size][size=2][color=#0000ff][size=2][color=#0000ff]Try [/color][/size][/color][/size][size=2][/size][size=2][color=#0000ff][size=2][color=#0000ff]Dim[/color][/size][/color][/size][size=2] btr [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] BlockTableRecord = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite, [/size][size=2][color=#0000ff][size=2][color=#0000ff]False[/color][/size][/color][/size][size=2]) line = [/size][size=2][color=#0000ff][size=2][color=#0000ff]New[/color][/size][/color][/size][size=2] Line(startPoint, endpoint) id = btr.AppendEntity(line) db.TransactionManager.AddNewlyCreatedDBObject(line, [/size][size=2][color=#0000ff][size=2][color=#0000ff]True[/color][/size][/color][/size][size=2]) tr.Commit() [/size][size=2][color=#0000ff][size=2][color=#0000ff]Catch[/color][/size][/color][/size][size=2] ex [/size][size=2][color=#0000ff][size=2][color=#0000ff]As[/color][/size][/color][/size][size=2] Exception tr.Abort() [/size][size=2][color=#0000ff][size=2][color=#0000ff]End[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Try [/color][/size][/color][/size][size=2][/size][size=2][color=#0000ff][size=2][color=#0000ff]End[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Using [/color][/size][/color][/size][size=2][/size][size=2][color=#0000ff][size=2][color=#0000ff]End[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Using [/color][/size][/color][/size][size=2][/size][size=2][color=#0000ff][size=2][color=#0000ff]Return[/color][/size][/color][/size][size=2] line [/size][size=2][color=#0000ff][size=2][color=#0000ff]End[/color][/size][/color][/size][size=2] [/size][size=2][color=#0000ff][size=2][color=#0000ff]Function [/color][/size][/color][/size] Any help welcome please Regards CaveMan Code
- 7 replies
-
- region items
- entity collections region
-
(and 2 more)
Tagged with:
-
I'm working on a road project that is 3 lane road. a northbound, southbound and center turn lane. At an intersection it changes into having a left turn lane only with a median. So my problem is that when I have multiple regions in my corridor with and offset assembly targeting a offset alignment the last (or first depending ion which side the offset is on) set of links between the sample lines on the offset side of the assembly go missing. I've built the assemblies multiple ways and built it using different baselines and the same problem keeps coming up....I'm lost on it. Any ideas?
-
The subtract region operation is something i have already done, but what i'm having trouble with is determining when a region is inside another one. Here I attach a sample file: cadtutor forum.dwg The main task is checking regions one by one, then determining whether it as or not another region inside. If it does, subtract the interior one. I don't know how to check if one contains another inside. Help!!