Flip an Object, which created with Offset

Flip an Object, which created with Offset

erhan.lale
Contributor Contributor
1,328 Views
4 Replies
Message 1 of 5

Flip an Object, which created with Offset

erhan.lale
Contributor
Contributor

Hello,

 

i want to add offset to a poly line and flip horizontally (without moving) and explode. 

 

But i have problem with object, which created with offset; Variable for offset is not a polyline, it is a variant.

 

Normal methods are not working with this object. I can not select the object, which created with offset. How can i create an object with offset and modify it?

 

My code is here:

 

Sub offset_and_flip()

' Create the polyline
Dim plineObj As AcadLWPolyline
Dim offsetObj As Variant
Dim points(0 To 7) As Double
points(0) = 0: points(1) = 0
points(2) = 0: points(3) = 2
points(4) = 2: points(5) = 2
points(6) = 4: points(7) = 0

Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
plineObj.Closed = True

' Define the mirror axis
Dim point1(0 To 2) As Double
Dim point2(0 To 2) As Double
point1(0) = 2: point1(1) = 3: point1(2) = 0
point2(0) = 2: point2(1) = 0: point2(2) = 0

'create offset
offsetObj = plineObj.Offset(-1)

' i get error message, if i write offsetObj instead of plineObj
Dim mirrorObj As AcadLWPolyline
Set mirrorObj = plineObj.Mirror(point1, point2)
plineObj.Erase
mirrorObj.Explode
End Sub

0 Likes
Accepted solutions (1)
1,329 Views
4 Replies
Replies (4)
Message 2 of 5

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> i want to add offset to a poly line and flip

>> horizontally (without moving)

That is what I get (screenshot and file attached), is that different to what you expect?

 

20190617_161631_0001.png

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 5

erhan.lale
Contributor
Contributor

I want to flip big object, but I can not do it. 

0 Likes
Message 4 of 5

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

then change

Set mirrorObj = plineObj.Mirror(point1, point2)

to

Set mirrorObj = offsetObj(0).Mirror(point1, point2)

For unknown results of offset you should first verify if elements were returned, and how many objects are returned (an offset of one polyline might result in many result items).

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 5 of 5

erhan.lale
Contributor
Contributor

it works, thank you very very very much!

0 Likes