lewis770227 Posted February 18, 2009 Share Posted February 18, 2009 I´m doing a code that created an array of blockRefObject and After that this resulting array I would like to modificate by transform method. Best regards Quote Link to comment Share on other sites More sharing options...
ReMark Posted February 18, 2009 Share Posted February 18, 2009 If you would be so kind. What is the transform method you speak of? Quote Link to comment Share on other sites More sharing options...
lewis770227 Posted February 18, 2009 Author Share Posted February 18, 2009 Look this code: Sub Example_ArrayRectangular() ' Create the circle Dim circleObj As AcadCircle Dim center(0 To 2) As Double Dim radius As Double Dim newUCS As AcadUCS Dim currUCS As AcadUCS Dim varUCSMatrix As Variant pb = ThisDrawing.Utility.GetPoint(, "basepoint: ") px = ThisDrawing.Utility.GetPoint(, "xdirection: ") py = ThisDrawing.Utility.GetPoint(, "ydirection: ") center(0) = 2#: center(1) = 2#: center(2) = 0# radius = 0.5 Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius) ThisDrawing.Application.ZoomAll ' Define the rectangular array Dim numberOfRows As Long Dim numberOfColumns As Long Dim numberOfLevels As Long Dim distanceBwtnRows As Double Dim distanceBwtnColumns As Double Dim distanceBwtnLevels As Double numberOfRows = 5 numberOfColumns = 5 numberOfLevels = 1 distanceBwtnRows = 1 distanceBwtnColumns = 1 distanceBwtnLevels = 1 Set newUCS = ThisDrawing.UserCoordinateSystems.Add(pb, px, py, "TestUCS") varUCSMatrix = newUCS.GetUCSMatrix ' Create the array of objects Dim retObj As Variant retObj = circleObj.ArrayRectangular(numberOfRows, numberOfColumns, numberOfLevels, distanceBwtnRows, distanceBwtnColumns, distanceBwtnLevels) retObj.TransformBy varUCSMatrix ZoomAll End Sub An error ocurrs in line transformBy, beside I don´t know how work distanceBwtnLevels and numberOfLevels in array definition Quote Link to comment Share on other sites More sharing options...
ReMark Posted February 18, 2009 Share Posted February 18, 2009 Sorry, I am not familiar with TransformBy. As for NumberOfLevels and DistanceBwtnLevels are you working with a 3D array by any chance? Quote Link to comment Share on other sites More sharing options...
SEANT Posted February 18, 2009 Share Posted February 18, 2009 The .TransformedBy method is limited to individual entities. You’ll probably have to do something like this: Dim retObj() As AcadEntity Dim varEnt As Variant Dim ent As AcadEntity retObj = circleObj.ArrayRectangular(numberOfRows, numberOfColumns, numberOfLevels, distanceBwtnRows, distanceBwtnColumns, distanceBwtnLevels) For Each varEnt In retObj Set ent = varEnt ent.TransformBy varUCSMatrix Next circleObj.TransformBy varUCSMatrix You may also find that ThisDrawing.UserCoordinateSystems.Add is pretty finicky about the input coordinates. Additional steps may be required to ensure that the two vectors are perpendicular. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.