| Author |
Message |
pfeifern
Guest
|
Posted:
Fri Mar 18, 2005 1:34 am Post subject:
Create a region from a polyline code? |
|
|
Does anyone have a sample VBA code for creating a region from a polyline. I can't figure it out.
thanks,
Nathan
|
|
| Back to top |
|
 |
Jeff Mishler
Guest
|
Posted:
Fri Mar 18, 2005 1:57 am Post subject:
Re: Create a region from a polyline code? |
|
|
This is very rudimentary, but it should give you a start....
| Code: |
Sub addRegion_Example()
Dim oEnt As AcadEntity
Dim vPick
Dim oRegions
Dim oRegObjects(0) As AcadEntity
ThisDrawing.Utility.GetEntity oEnt, vPick, "Select pline to create region
from: "
If TypeOf oEnt Is AcadLWPolyline Then
Set oRegObjects(0) = oEnt
oRegions = ThisDrawing.ModelSpace.AddRegion(oRegObjects)
End If
End Sub
|
--
Jeff
check out www.cadvault.com
"pfeifern" <nospam@address.withheld> wrote in message
news:4898388.1111091723943.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | Does anyone have a sample VBA code for creating a region from a polyline.
I can't figure it out.
thanks,
Nathan |
|
|
| Back to top |
|
 |
pfeifern
Guest
|
Posted:
Fri Mar 18, 2005 2:22 am Post subject:
Re: Create a region from a polyline code? |
|
|
thanks for the post. Im actually looking to convert the following polyline code in to a region automatically (without having to pick).
Sub Example_AddLightWeightPolyline()
' This example creates a light weight polyline in model space.
Dim plineObj As AcadLWPolyline
Dim points(0 To 9) As Double
' Define the 2D polyline points
points(0) = 0: points(1) = 0
points(2) = 2: points(3) = 0
points(4) = 2: points(5) = 2
points(6) = 0: points(7) = 2
points(8) = 0: points(9) = 0
' Create a light weight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
End Sub
|
|
| Back to top |
|
 |
pfeifern
Guest
|
Posted:
Fri Mar 18, 2005 2:25 am Post subject:
Re: Create a region from a polyline code? |
|
|
thanks for the post. Im actually looking to convert the following polyline code in to a region automatically (without having to pick).
Sub Example_AddLightWeightPolyline()
' This example creates a light weight polyline in model space.
Dim plineObj As AcadLWPolyline
Dim points(0 To 9) As Double
' Define the 2D polyline points
points(0) = 0: points(1) = 0
points(2) = 2: points(3) = 0
points(4) = 2: points(5) = 2
points(6) = 0: points(7) = 2
points(8) = 0: points(9) = 0
' Create a light weight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
End Sub |
|
| Back to top |
|
 |
Joe Sutphin
Guest
|
Posted:
Fri Mar 18, 2005 2:35 am Post subject:
Re: Create a region from a polyline code? |
|
|
Take the plineObj created by your code and poke it in the objRegObjects(0)
array and you have it.
Joe
--
"pfeifern" <nospam@address.withheld> wrote in message
news:6775149.1111094754725.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | thanks for the post. Im actually looking to convert the following polyline
code in to a region automatically (without having to pick).
Sub Example_AddLightWeightPolyline()
' This example creates a light weight polyline in model space.
Dim plineObj As AcadLWPolyline
Dim points(0 To 9) As Double
' Define the 2D polyline points
points(0) = 0: points(1) = 0
points(2) = 2: points(3) = 0
points(4) = 2: points(5) = 2
points(6) = 0: points(7) = 2
points(8) = 0: points(9) = 0
' Create a light weight Polyline object in model space
Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
End Sub |
|
|
| Back to top |
|
 |
pfeifern
Guest
|
Posted:
Sat Mar 19, 2005 2:45 am Post subject:
Re: Create a region from a polyline code? |
|
|
| thanks Joe, By the way I've got your book and it's becoming a great resource for me (im an AutoCAD vet, but new to the programming thing). |
|
| Back to top |
|
 |
|
|
|
|