AutoCAD.Mline
Inherits from AutoCAD.Entity
Description
A class that encapsulates an Mline in a DWG file.
This class is a FlexScript wrapper for the AcDbMline class.
AutoCAD.Database db = AutoCAD.Database("C:\\Path\\to\\my\\file.dwg");
if (!db)
return 0;
var iter = db.getBlockTable().getAt("*Model_Space").newIterator();
for (iter.start(); !iter.done(); iter.step()) {
var ent = iter.getEntity();
if (ent.is(AutoCAD.Mline)) {
var mline = ent.as(AutoCAD.Mline);
int numVerts = mline.numVerticies;
double scale = mline.scale;
Vec3 vertex = mline.getVertexAt(numVerts-1);
Vec3 randomPoint = (duniform(-1, 1), duniform(-1, 1), duniform(-1, 1));
// The search will use virtual extension and include the caps.
Vec3 closestPoint = mline.getClosestPointTo(randomPoint, 1);
...
}
}
Properties
numVerticies | The number of verticies in the Mline. |
scale | The scale of the Mline. |
Methods
create | Creates a new AutoCAD.Mline object. |
getClosestPointTo | Finds the point on the Mline that is closest to givenPoint. |
getVertexAt | Gets the vertex as index. |
Details
Do no remove, this fixes the anchor on doc.flexsim.com
AutoCAD.Mline.numVerticies
readonly int numVerticies
Description
The number of verticies in the Mline.
Do no remove, this fixes the anchor on doc.flexsim.com
AutoCAD.Mline.scale
double scale
Description
The scale of the Mline.
This controls the overall width of the Mline. This scale factor is based on the width established in the MlineStyle definition. A scale factor of 2 produces an Mline object twice as wide as the style definition.Do no remove, this fixes the anchor on doc.flexsim.com
AutoCAD.Mline.create()
AutoCAD.Mline create( ) |
Returns
AutoCAD.Mline | A new AutoCAD.Mline object. |
Description
Creates a new AutoCAD.Mline object.
var mline = AutoCAD.Mline.create();
Do no remove, this fixes the anchor on doc.flexsim.com
AutoCAD.Mline.getClosestPointTo()
Vec3 getClosestPointTo( Vec3 givenPoint , int extended = 0 , int excludeCaps = 0 ) |
Parameters
givenPoint | The input point to find the nearest point on the Mline to. |
extended | Whether or not the search should include "virtual" extension of Mline. If 0, then the search will not include "virtual" extension. |
excludeCaps | Whether or not endcaps should be included in the nearest point search. If 0, then caps will NOT be excluded (i.e. caps WILL be included in the search). |
Returns
Vec3 | The closest point on the Mline to the given point. |
Description
Finds the point on the Mline that is closest to givenPoint.
If extend is 1, then the Mline will be "virtually" extended to find the closest point. If excludeCaps is 1, then any endcaps on the mline will be ignored.Do no remove, this fixes the anchor on doc.flexsim.com
AutoCAD.Mline.getVertexAt()
Vec3 getVertexAt( int index ) |
Parameters
index | The index (0-based) of the vertex you want to get. |
Returns
Vec3 | The coordinates of the vertex at the desired index in the Mline object. |
Description
Gets the vertex as index.