Community
Try the html code for the symbols:
< & lt > & gt (put the & and lt, gt together)
Put code here and it retains its formatting
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"jpkycek" wrote in messageThanks
href="news:6113754@discussion.autodesk.com">news:6113754@discussion.autodesk.com...
Laurie, I have not posted code in a long while, so I am getting re-aquainted
with the changed format. I hope this re-post is readable. > 'SubName:
Offset3dPoly 'Author: Joe Kycek, Date: 3/24/02 'Scope: Offset a 3dPoly with
horizontal and vertical distances. ' ' ' Requirements: ' ' a) A 3dpoly object
' b) A horizontal offset distance from the 3dpoly to ' the new 3dpoly. ' c) A
vertical offset distance from the 3dpoly to ' the new 3dpoly. ' d) A layer for
the new 3dpoly. ' ' Returns: ' ' i) A new 3dpoly object. ' 'Notes: ' 1) A
positive horizontal distance value offsets to the Right. ' 2) A positive
vertical distance value offsets vertically Up. ' 3) Just like the regular
Offset command in AutoCad: Offsets ' that do not mathematically fit, may bring
unexpected results. ' This sub uses the AutoCad offset function to achieve a
part ' of its goals. So the rules regarding the standard ' AutoCad offset
command apply. ' Sub Offset3dPoly( _ o3dpoly As Acad3DPolyline, _
dDistanceHorizontal As Double, _ dDistanceVertical As Double, _ s3dPolyLayer
As String, _ o3dpolynew As Acad3DPolyline) Dim v2dPoly As Variant Dim v3dPoly
As Variant Dim v3dPolyFlat As Variant Dim o2dPoly As AcadPolyline Dim
o2dPolyOffset As AcadPolyline Dim StartX As Double Dim StartY As Double Dim
StartZ As Double Dim EndX As Double Dim EndY As Double Dim EndZ As Double Dim
i As Integer On Error GoTo 10 'Get the 3dpolys' coordinate array. v3dPoly =
o3dpoly.Coordinates v3dPolyFlat = o3dpoly.Coordinates 'With the 3dpolys'
coordinate array; flatten 'the z elevations to 0, so we can create a 2dpoly.
For i = 0 To ((UBound(v3dPolyFlat) + 1) / 3) - 1 v3dPolyFlat(3 * i + 2) = 0
Next 'get the 3dpolys starting and ending coordinates 'to be used later for
checking. StartX = v3dPoly(0) StartY = v3dPoly(1) StartZ = v3dPoly(2) EndX =
v3dPoly(UBound(v3dPoly) - 2) EndY = v3dPoly(UBound(v3dPoly) - 1) EndZ =
v3dPoly(UBound(v3dPoly)) 'Create a 2dPoly with the same x,y coordinates as the
3dpoly. 'Use this object later; for offsetting. Set o2dPoly =
ThisDrawing.ModelSpace.AddPolyline(v3dPolyFlat) 'If the 3dpoly is closed, or
the 3dpoly's start and end 'coordinates are the same; 'then close the 2dpoly
object: for offseting. If o3dpoly.Closed = True _ Or _ StartX = EndX And
StartY = EndY And StartZ = EndZ Then o2dPoly.Closed = True End If 'The api
does not support a zero 2dpoly offset. But we could 'be creating a new 3dpoly
that is vertically straight up or 'down from the original 3dpoly, with no
offset, 'so... an if statement is needed here; If dDistanceHorizontal <>
0 Then 'Create a 2dpoly object array; by the offset distance supplied. v2dPoly
= o2dPoly.offSet(dDistanceHorizontal) 'Create a new 2dPoly object from the
object array. Set o2dPolyOffset = v2dPoly(0) 'Get the offsetted 2dpoly
coordinates v2dPoly = o2dPolyOffset.Coordinates 'delete the offsetted 2dpoly.
o2dPolyOffset.Delete Set o2dPolyOffset = Nothing Else 'the horizontal offset
is 0, so use the non-offsetted 'coordinates from the the new 2dpoly. v2dPoly =
o2dPoly.Coordinates End If 'Next, Modify the offsetted 2dpolys' coordinates;
by adding the original '3dpoly z elevations plus the supplied Vertical
additive. For i = 0 To ((UBound(v2dPoly) + 1) / 3) - 1 v2dPoly(3 * i + 2) =
v3dPoly(3 * i + 2) + dDistanceVertical Next 'Create the new 3dPoly. Set
o3dpolynew = ThisDrawing.ModelSpace.Add3DPoly(v2dPoly) 'if the 2dpoly is
closed, then close the new 3dpoly If o2dPoly.Closed = True Then
o3dpolynew.Closed = True End If 'Set the layer for the new 3dPoly.
o3dpolynew.Layer = s3dPolyLayer 10: 'delete the 2dpoly. o2dPoly.Delete Set
o2dPoly = Nothing End Sub < Thanks, Joe Edited by: jpkycek on Jan 28, 2009
10:41 PM
'SubName: Offset3dPoly
'Author: Joe Kycek, Date: 3/24/02
'Scope: Offset a 3dPoly with horizontal and vertical distances. ' ' '
Requirements: '
' a) A 3dpoly object ' b) A horizontal offset distance from the 3dpoly to
' the new 3dpoly. ' c) A vertical offset distance from the 3dpoly to
' the new 3dpoly. ' d) A layer for the new 3dpoly. ' ' Returns: '
' i) A new 3dpoly object. '
'Notes: ' 1) A positive horizontal distance value offsets to the Right.
' 2) A positive vertical distance value offsets vertically Up.
' 3) Just like the regular Offset command in AutoCad: Offsets
' that do not mathematically fit, may bring unexpected results.
' This sub uses the AutoCad offset function to achieve a part
' of its goals. So the rules regarding the standard
' AutoCad offset command apply. '
Sub Offset3dPoly( _
o3dpoly As Acad3DPolyline, _
dDistanceHorizontal As Double, _
dDistanceVertical As Double, _
s3dPolyLayer As String, _
o3dpolynew As Acad3DPolyline)
Dim v2dPoly As Variant
Dim v3dPoly As Variant
Dim v3dPolyFlat As V
ariant
Dim o2dPoly As AcadPolyline
Dim o2dPolyOffset As AcadPolyline
Dim StartX As Double
Dim StartY As Double
Dim StartZ As Double
Dim EndX As Double
Dim EndY As Double
Dim EndZ As Double
Dim i As Integer
On Error GoTo 10 'Get the 3dpolys' coordinate array.
v3dPoly = o3dpoly.Coordinates
v3dPolyFlat = o3dpoly.Coordinates 'With the 3dpolys' coordinate
array; flatten
'the z elevations to 0, so we can create a 2dpoly.
For i = 0 To ((UBound(v3dPolyFlat) + 1) / 3) - 1
v3dPolyFlat(3 * i + 2) = 0
Next 'get the 3dpolys starting and ending coordinates 'to be used
later for checking.
StartX = v3dPoly(0)
StartY = v3dPoly(1)
StartZ = v3dPoly(2)
EndX = v3dPoly(UBound(v3dPoly) - 2)
EndY = v3dPoly(UBound(v3dPoly) - 1)
EndZ = v3dPoly(UBound(v3dPoly))
'Create a 2dPoly with the same x,y coordinates as the 3dpoly.
'Use this object later; for offsetting.
Set o2dPoly = ThisDrawing.ModelSpace.AddPolyline(v3dPolyFlat)
'If the 3dpoly is closed, or the 3dpoly's start and end 'coordinates are
the same;
'then close the 2dpoly object: for offseting.
If o3dpoly.Closed = True _
Or _
StartX = EndX And StartY = EndY And StartZ = EndZ Then
o2dPoly.Closed = True
End If
'The api does not support a zero 2dpoly offset. But we could
'be creating a new 3dpoly that is vertically straight up or
'down from the original 3dpoly, with no offset,
'so... an if statement is needed here;
If dDistanceHorizontal <> 0 Then
'Create a 2dpoly object array; by the offset distance supplied.
v2dPoly = o2dPoly.Offset(dDistanceHorizontal)
'Create a new 2dPoly object from the object array.
Set o2dPolyOffset = v2dPoly(0)
'Get the offsetted 2dpoly coordinates
v2dPoly = o2dPolyOffset.Coordinates
'delete the offsetted 2dpoly.
o2dPolyOffset.Delete
Set o2dPolyOffset = Nothing
Else
'the horizontal offset is 0, so use the non-offsetted 'coordinates from
the the new 2dpoly.
v2dPoly = o2dPoly.Coordinates
End If
'Next, Modify the offsetted 2dpolys' coordinates; by adding the original
'3dpoly z elevations plus the supplied Vertical additive.
For i = 0 To ((UBound(v2dPoly) + 1) / 3) - 1
v2dPoly(3 * i + 2) = v3dPoly(3 * i + 2) + dDistanceVertical
Next 'Create the new 3dPoly.
Set o3dpolynew = ThisDrawing.ModelSpace.Add3DPoly(v2dPoly)
'if the 2dpoly is closed, then close the new 3dpoly
If o2dPoly.Closed = True Then
o3dpolynew.Closed = True
End If
'Set the layer for the new 3dPoly.
o3dpolynew.Layer = s3dPolyLayer
10: 'delete the 2dpoly.
o2dPoly.Delete
Set o2dPoly = Nothing
End Sub
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"anthonylrhodes" wrote in messageSorry
href="news:6114128@discussion.autodesk.com">news:6114128@discussion.autodesk.com...
this is somewhat off topic. For those of you who try to decode garbled code.
Would it work to copy the code into AutoCAD's lisp editor and have the program
reset the formatting? I am no expert it is just a thought. I tried it with the
code above and was told there were 8 unbalanced brackets found. That code does
not look like the regular lisp code I have seen so that may be the problem.
Sorry for interrupting just trying to help 🙂
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Allen Jessup
CAD Manager - Designer
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.