anibal_pp Posted August 13, 2008 Share Posted August 13, 2008 I'm having problems just to understand how does the asignment and object creation occurs. In this case, I just wanna get the 3dpolyline's coordinates. Note that the polyline was already drawn by hand, I dont need to draw it from VBA, just read its properties Dim plineObj As Acad3DPolyline Dim fObject As AcadObject Dim ssetObj As AcadSelectionSet On Error Resume Next ThisDrawing.SelectionSets.Item("test_sel").Delete Set ssetObj = ThisDrawing.SelectionSets.Add("test_sel") ssetObj.SelectOnScreen For i = 0 To ssetObj.Count - 1 Set fObject = ssetObj.Item(i) MsgBox fObject.ObjectName + " " + fObject.Handle, vbYesNo,"test" If (fObject.ObjectName = "AcDb3dPolyline") Then ' ****problems with this assignment why?? (neither Set plineObj = fObject works) Set plineObj = ssetObj.Item(i) ' Return all the coordinates of the polyline (doesnt work ) Dim retCoord As Variant retCoord = plineObj.Coordinates End If Next i regards, anibal Quote Link to comment Share on other sites More sharing options...
rocheey Posted August 13, 2008 Share Posted August 13, 2008 Your code runs fine here. Are you sure you are actually selecting a 3d polyline? Remember, there are *3* types of polylines ... Also, you might just want to revisit the error handling - firstly, the "On Error Resume Next" call only works if you also have "Break on Unhandled Errors" selected in "Options". Some pc's seem to have "Break On All Errors" set.. in which case it will error out irregardless of your error trap. Secondly, you never *cancelled* the error trap after your call for the selection set.. in which case, any error your code runs into (asuming you have "Break on Unhandled Errors" selected ) will not show you the error .. it will blindly go on with the next line of code. At a minimum, I would double check the polyline type, and add an " On Error GoTo 0" after the line "ThisDrawing.SelectionSets.Item("test_sel").Delete" Quote Link to comment Share on other sites More sharing options...
borgunit Posted August 13, 2008 Share Posted August 13, 2008 You might try using "DIM plineObj as AcadObject" and see if that works then. Quote Link to comment Share on other sites More sharing options...
rocheey Posted August 13, 2008 Share Posted August 13, 2008 But isn't he already doing that, using the 'fObject' acadobject, before assigning specifically to the acad3dpolyline? Quote Link to comment Share on other sites More sharing options...
borgunit Posted August 13, 2008 Share Posted August 13, 2008 Depending on the service pack and version, I believe this can get convoluted in certain AutoCAD's. I can't remember the case, but this was a issue for me in the past. As an FYI, here is Mr McSwains excellent explanation of plines... http://rkmcswain.blogspot.com/2007/12/autocad-polyline-types.html 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.