tmccar Posted March 10, 2016 Posted March 10, 2016 (edited) I was looking at the "VBA and Excel" program on the AfraLisp website and I am trying to code my own application which is based on it. I had a question on this portion of code [color="red"]Private Sub UserForm_Initialize() Dim BlkG(0) As Integer Dim TheBlock(0) As Variant Dim Pt1(0 To 2) As Double Dim Pt2(0 To 2) As Double 'declare local variables Set acad = GetObject(, "AutoCAD.Application") 'set reference to AutoCAD Set doc = acad.ActiveDocument 'set reference to the drawing Set ms = doc.ModelSpace 'set reference to model space Set ssnew = doc.SelectionSets.Add("TBLK") 'create a selection set Pt1(0) = 0: Pt1(1) = 0: Pt1(2) = 0 Pt2(0) = 3: Pt2(1) = 3: Pt2(2) = 0 'set up the array BlkG(0) = 2 'group code 2 for block name TheBlock(0) = "MATLIST" 'the name of the attribute block ssnew.Select 5, Pt1, Pt2, BlkG, TheBlock 'get the block [/color] What is the array for? (Pt1(0), Pt1(0) .. etc) Edited March 10, 2016 by tmccar Quote
Tyke Posted March 10, 2016 Posted March 10, 2016 (edited) Firstly you need to read up on how to properly post code on the forum and not simply use copy and paste. There are two arrays Pt1() and Pt2() and each array has 3 elements which are the X,Y,Z coordinates of two points. Edited March 10, 2016 by Tyke Quote
SLW210 Posted March 10, 2016 Posted March 10, 2016 Please read the Code Posting Guidelines and edit your post to include the Code in Code Tags [NOPARSE] CODE GOES HERE [/NOPARSE]. Quote
tmccar Posted March 10, 2016 Author Posted March 10, 2016 Please read the Code Posting Guidelines and edit your post to include the Code in Code Tags [NOPARSE] CODE GOES HERE [/NOPARSE]. Ok, I hope it looks ok now. I was wondering what were the points used for? Quote
BIGAL Posted March 11, 2016 Posted March 11, 2016 The points are for a window selection 0,0,0 3,3,0 This little bit may help note you can get at block attributes by the order of creation you do not need tag name. Set SS = ThisDrawing.SelectionSets.Add("pit1sel") SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal For Cntr = 0 To SS.Count - 1 If SS.Item(Cntr).Name = BLOCK_NAME Then attribs = SS.Item(Cntr).GetAttributes If attribs(0).TextString = pitname Then Quote
tmccar Posted March 11, 2016 Author Posted March 11, 2016 The points are for a window selection 0,0,0 3,3,0 This little bit may help note you can get at block attributes by the order of creation you do not need tag name. Set SS = ThisDrawing.SelectionSets.Add("pit1sel") SS.Select acSelectionSetAll, , , FilterDXFCode, FilterDXFVal For Cntr = 0 To SS.Count - 1 If SS.Item(Cntr).Name = BLOCK_NAME Then attribs = SS.Item(Cntr).GetAttributes If attribs(0).TextString = pitname Then Ok, I get it! Thanks BIGAL Quote
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.