AutoCAD .NET :: How To Test For Existence Of Self Intersecting 2D Polylines
Apr 8, 2011
Im trying to write a routine in VB.net based on Fenton's examples from 'Zero to 3D in 60 Minutes'. the routine uses a filter set to select all 2D polylines in a document then a test is needed for each polyline to establish whether it is a loop, which can then be extruded into a solid or it is a non loop, where the operation will need to be an extruded surface, or if the polyline is a non-loop.
So far my code will pick up every 2D polyline and try and extrude it, but i need to catch the non-looped entities to handle them with an extrude surface method or if self-intersecting polylines, to either drop them and not cause an exception or process them in another way.
What entity attributes or methods should I use to perform testing to establish this loop and non-loop existance of the polylines to achieve this. I work with both C# and VB.net.
Essentially, I'll be creating a sort of Venn diagram. So for the purposes of this exercise, let's assume it's the classic Venn diagram of three intersecting circles. But I need this to work with closed polylines, that may also have arc segments in them.
Anyway, so I have these intersecting areas, and I need to create bounding polylines for each area, and assess the number of overlaps. So, as in a Venn diagram, the areas where only one circle is present can then get shaded one color, areas where two circles are overlapping can get a different color, and the area where all three circles overlap can get a third color.
I'm clearly going to have to be converting the various boundaries to Regions, and performing some Unions. It seems I could grab all objects, convert them to Regions 2 at a time, and compare their Union'ed area to their individual area, to determine if they overlapped at all. With only the 3 cirlces, that would work, but when I have 35 individual polyline areas with arcs, suddenly this method feels like it will break down.
I have a specific need to determine if an entity is existing or not so that I can either make changes to or create the entity. I'm trying to do this while referring to the entity by it's handle. Below is my code this far but it doesn't work.
(IF (AND (SETQ HNDL (VLAX-LDATA-GET "TB" (STRCAT PLN "PLAN"))) (NOT (VLAX-ERASED-P (VLAX-ENAME->VLA-OBJECT (HANDENT HNDL)))) ) (PROGN ;;| DO SOMETHING WITH THE EXISTING ENTITY ) (PROGN ;;| MAKE THE ENTITY (vlax-ldata-put "TB" (strcat PLN "PLAN") (CDR (ASSOC 5 (entget (entlast))))) ))
I ran the program and the handle was stored, then I deleted the entity and ran the code again and this is the error I get:
; error: unable to get ObjectID: nil
This VLISP stuff sometime has unpredictable hoops to jump through first, so I wondering if this is the case here.
As the above mentioned, I have a drawing drawn using polylines with width from someone. The width of the line are suppose to represent area,
To put things into prospective, here is an example:
The polyline is 10 unit long and with a width of 2 unit wide. If i explode that polyline, it will become a single polyline without width. The line are suppose to represent 10 unit long and 2 unit wide; representing an area.
My question is is there a way to change the line above directly from polyline with width to a close polyline (4 x polylines) of 10 unit long and 2 unit wide.
I know it doesn't work because if I change the T to nil as demonstrated bellow I should invoke the opposite reaction from autocad but instead I get the exact same outcome which is an alert telling me the file exists?
Is there a way of converting 3d polylines to polylines with an elevation?
I have a dwg of contour information, the contours are 3d polylines, because they are contours the z value is constant all along the line, so there no question what the elevation of the polyline would need to be.
I need to do this as I then need to import the dwg into a GIS programme called MapInfo whch doesn't read 3d polylines.
I'm writing a Javascript to run at startup. I want to check for the existence of XML files and process them, if they are available. How can I check for their existence?
I normally get the UCS directions as part of a test to see if current coord system is same as world:
I am seeing a nonnormal UCSxdir and Ydir for several drawings with UCS I know is on world. See the above value.
It took me a while to realize it was because the drawing had ps viewports, and the viewport UCS was user.
How would I get what I would call "the modelspace current coord system info" to do this test.
I am doing this with a drawing not open in the editor, it is DBX style. If it was not, I could do all kinds of things to figure out if modelspace was on world ucs.
how to test to see if a drawing is already open inAutoCAD using VBA and if it to make it the active document?I have a VBA macro to open xrefs by by just picking them in the drawing butI need to test to see if the drawing may already be open to avoid openingthe drawing a second time in "Read Only" mode.
I am just starting to create some custom linetypes. All is well with solid lines with text. However I have reached a stumbling block as far as hidden lines go.
Basically I get this result -----x-----x-----x-----x-----x-----x-----x-----x-----x But I am looking for this --------------------x--------------------x--------------------
Not sure how to do this as I get an error message saying that I can only have 12 dash/dot entries before the text.
The plumbers in our don't want to see text that often.
How do I project the Proposed Road Level information from Road_1 at the intersection of Road_2 (Alignment_GA.jpg) onto the Start of the Profile for Road_2 (Alignment_Profile.jpg) to give me my tie in start point?
How do I obtain the exact change of the intersection Point? How can i extend Road_2 onto the horizontal curve of Road_1 so i know they exactly intersect?
I am trying to create a CAD drawing for the construction of Paddle Pop sticks. It is the basic shape of the Magnum sticks, but it is tricky because it has a 140 diameter taper, from the top of the jig to the bottom. I am trying to make the circle attached to the shape of the stick, and the Sweep the circle around the shape. But when I try to sweep it around, it says "The sweep results in a self-intersecting circle". I am using AutoCAD 2012.
P.S. I have attached the .dwg file so that it makes more sense.
Is there a way to simulate a simple tensile test in autodesk inventor. Let's say I draft up a 1" x 1" x 10" bar. If I input all of the material properties such as yield strength, tensile strength, % elongation etc., is there a way that I can simulate a simple uniaxial tension test on this bar? If so, how do I set it up with the autodesk simulation engine?
Text is displaying at the incorrect size in both paper space and model space. It seems that there may be some kind of global scale factor in action e.g. if I add text at size 2.5, it displays at size 2.25 and if I add text at size 1.8, it displays at size 1.62.
How do I set so that text is displayed at the correct size?
How would I test for duplicate handles in a file. If I select a cirlce from an xref and it has a handle of "E6" Then I select another circle from a different xref that has the same handle. When I use GetObjectId how do I specify which handle? Is there a way to give a handle and a file path and have it point to the correct entity or would I need to cycle through all entities and check for matching handle and file name?
In the end I would like to select an object, then store that data in a file and then recall that exact same object later.
I'm testing out a simple Block Table in the Dynamic Block editor and when I go to save the Block, the following alert pops up. Is there a way to "test" the Block to check all the necessary constraints? Or am I just suppose to go about this with good 'ol fashioned trial and error? Seems the block is working just fine so is the alert just a moot point?
I am trying to modify a hoop instead of having a half circle, i half to cut the hoop short and add a flange, instead of starting over, is there a command I can use that I can create a flange and join the hoop and flange at the intersect..... the hoop was made using the fold feature...
I am a beginner with AutoCad software, and I am currently using Civil 3D/Map 3D 2009.I imported a shp. file containing property information (owner, area, address, etc), and also imported an alignment row as a sdf. file. The row is a closed polygon.
My goal is to intersect these two types of data so that I end up with information on the number of properties affected by the row.
Is civil 3d 2009 capable of doing this? If so, how? I found a youtube video on using the 'Offset Alignment' command with Civil 3D 2010, however, is not the same for 2009.
is there a command or workflow to split all intersecting surfaces? currently we build surface models and split manually or open in autocad, explode, overkill, breakall, then export the lines for rebuilding in an FE package.
Ideally we would like to export straight from inventor with one hit i would like to do the 5 splits below the EOP marker automatically
is there a command or workflow to split all intersecting surfaces? currently we build surface models and split manually or open in autocad, explode, overkill, breakall, then export the lines for rebuilding in an FE package.
we would like to export straight from inventor with one hit
I have been working on this project for awhile, trying to get it to extrude. The top drawing of the shape is when I created it, still as lines and arcs. The bottom pices are what I have broken it into and joined as polylines for extrusion. The top most piece of these is the one I have been working with, with no solution found. The 3 smallest of these pieces do extrude, but I need all of them to extrude as they are all different heights.
Once this extrusion problem is solved, the rest is just unioning it together and to the rest of my project. I have tried exploding them, overkilling them and joining them again, I have tried the boundary method I have found on forums, nothing is working. I have gone through with a fine tooth comb on the top most section and made sure there wasn't anything extra. I have tried using pedit on it, and many of the commands say you can't do this on a closed polyline. If its a closed polyline, why won't it extrude? I could find anywhere where it was "Self intersecting curves" like the error says when I try to extrude it.
I have a rectangular chute, tapering in width and height, and intersecting, at an angle, with a round duct. I can't seem to find a way to determine the cut-out in the round duct.
Because the chute tapers projecting the size onto a flat plane to then project onto the round duct doesn't work.
I am working on an AutoCAD OEM based product. I need to compare two DWG files as a part of GUI test automation. What is the best way to do it?
I have already explored Compare DWG, a third party tool available as a Menu option in AutoCAD. However, the ObjectARX library used by this tool does not get loaded onto the product under test. It gives a linker error as follows:
AcRxDynamicLinker failed to load 'C:Program FilesFurixCompareDWG 2006frxc2006_calc.arx'
I have a main road corridor and a small access road corridor that intersects the main road. I don't want the intersection to have curb returns because I just want the access road to act as a driveway enterance (main road curb will run straight through and just get depressed at the access road enterance). However, I want the daylighting for the main corridor and the access road corridor to match up at this intersection and I'm not sure how to do this.
Lets say you have a polyline snapped perpendicular to an acr and you start zooming in they tend to separate. In the past a simple regen would magically make them display as intersecting lines (no gap or overlap). Right now the regen isn't working and I can't figure out why or what changed. I tried changing the VIEWRES but that didn't seem to work. What else could it be? I don't even have to zoom in that far to notice the overlap.
Infrastructure Design Suite 2014 Civil 3D 2013 sp2 Windows 7 x 64, 16 GB Intel Xeon @ 2.80 GHz NVIDIA Quadro K2000