basepointdesignz
Programmer
Hi,
I'm trying to write a program that will plot all modelspace part schedules for certain projects. Basically around each A4 schedule page i have drawn a polyline on the VP-PLOT layer, which acts as the boundary to window-plot the schedule..
What I want the program to do is search for all of those polylines on that layer and use the bounding box of the polyline as the window coordinates for a window-plot..
There will be 2 option of how to capture the required schedules. One button for ALL SCHEDULES, basically selecting the entire drawing, and the cmdWINDOW_Click is for a user window selection. But for now i only have the window select button working. Well i say working, but this is why i am posting the code here - its not doing what it's supposed to do, so could anyone help me out, point me in the right direction, correct my code.
So far, i have coded it so that to see if the code is working, it draws lines from corner-to-corner of the required print areas. Once this is working, i'll chuck in the code to plot..
As all it's getting is as far as picking the selection window and then returning back to the form, but as far as drawing the line across the area which is going to print nothing happens..
....as i said before, if anyone could point out my mistakes and / or correct me or just point me in the right direction, i would be very thankful..
Cheers,
Paul
basepointdesignzltd..
P4 3.0Ghz / 2GB RAM
XP Pro SP2
Sapphire X1950 512MB Dual-DVi Graphics Card..
I'm trying to write a program that will plot all modelspace part schedules for certain projects. Basically around each A4 schedule page i have drawn a polyline on the VP-PLOT layer, which acts as the boundary to window-plot the schedule..
What I want the program to do is search for all of those polylines on that layer and use the bounding box of the polyline as the window coordinates for a window-plot..
There will be 2 option of how to capture the required schedules. One button for ALL SCHEDULES, basically selecting the entire drawing, and the cmdWINDOW_Click is for a user window selection. But for now i only have the window select button working. Well i say working, but this is why i am posting the code here - its not doing what it's supposed to do, so could anyone help me out, point me in the right direction, correct my code.
So far, i have coded it so that to see if the code is working, it draws lines from corner-to-corner of the required print areas. Once this is working, i'll chuck in the code to plot..
As all it's getting is as far as picking the selection window and then returning back to the form, but as far as drawing the line across the area which is going to print nothing happens..
Code:
Option Explicit
Dim baseX As Variant 'First point for window selection..
Dim baseY As Variant 'Second point for window selection..
Dim entityX As AcadEntity 'Acad Objects..
Dim selectset As AcadSelectionSet 'Selection set..
Dim FType(0 To 1) As Integer 'Filter type..
Dim FData(0 To 1) As Variant 'Filter data..
Dim MinExt As Variant 'Min (bottom-left) point for each rectangle..
Dim MaxExt As Variant 'Max (top-right) point for each rectangle..
Dim linex As AcadLine
Dim i As Integer 'Count..
Private Sub cmdPLOT_Click()
' Awaiting code..
End Sub
' GET SELECTION SET BY WINDOW..
Private Sub cmdWINDOW_Click()
plotflashform.HIDE
'GET FIRST CORNER OF THE BORDER RECTANGLE..
'Error Test for GetPoint method..
On Error Resume Next
TryAgain:
baseX = ThisDrawing.Utility.GetPoint(, "Pick the first corner of the window..")
ErrHndlr:
If Err.Number <> 0 Then
Err.Clear
GoTo TryAgain
End If
On Error GoTo ErrHndlr
'GET SECOND CORNER OF THE BORDER RECTANGLE..
' Error Test for GetCorner method..
On Error Resume Next
TryAgain2:
baseY = ThisDrawing.Utility.GetCorner(baseX, "Pick the second corner of the window..")
ErrHndlr2:
If Err.Number <> 0 Then
Err.Clear
GoTo TryAgain2
End If
On Error GoTo ErrHndlr2
Err.Clear 'Clear the Error log..
'GET SELECTION SET..
Set selectset = ThisDrawing.SelectionSets.Add("Schedules")
'SET FILTER DATA..
FType(0) = 8: FData(0) = "VP-PLOT"
FType(1) = 0: FData(1) = "Polyline"
' Build selection set..
selectset.Select acSelectionSetWindow, baseX, baseY, FType, FData
'Draw a line through each print-frame just as a test to see if the code works for now..
For Each entityX In selectset
entityX.GetBoundingBox MinExt, MaxExt
Set linex = ThisDrawing.ModelSpace.AddLine(MinExt, MaxExt)
Next
' Display number of schedules to plot..
lbl1.Caption = "Number of Schedules to Plot: " & selectset.Count
' Show the user form for more options..
plotflashform.Show
End Sub
'
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
' Delete all selection sets in drawing..
For Each selectset In ThisDrawing.SelectionSets
selectset.Delete
Next
End Sub
....as i said before, if anyone could point out my mistakes and / or correct me or just point me in the right direction, i would be very thankful..
Cheers,
Paul
basepointdesignzltd..
P4 3.0Ghz / 2GB RAM
XP Pro SP2
Sapphire X1950 512MB Dual-DVi Graphics Card..