Misschien is dit de oplossing: http://through-the-interface.typepad.com/through_the_interface/2006/09/automatic_loadi.html?
Steven.
Steven.
Deze sectie stelt je in staat om alle bijdragen van dit lid te bekijken. Je kunt alleen de bijdragen zien waar je op dit moment toegang toe hebt.
Toon bijdragen MenuCall Module1.rijboring
Public Sub rijboring()
'Variabelen
Dim retObj1 As AcadObject
Dim retObj2 As AcadObject
Dim retPunt1(0 To 2) As Double
Dim retPunt2(0 To 2) As Double
Dim Cirkel1 As AcadCircle
Dim Cirkel2 As AcadCircle
Dim punt1(0 To 2) As Double
Dim punt2(0 To 2) As Double
Dim lengte As Double
Dim minAfstand As Double
minAfstand = 100
Dim afstand As Double
Dim aantal As Double
'Duid de eerste cirkel aan
Cirkel1:
ThisDrawing.Utility.GetEntity retObj1, retPunt1, "Duid de eerste cirkel aan..."
'Controleer of het een cirkel is
If retObj1.ObjectName = "AcDbCircle" Then
Set Cirkel1 = retObj1
punt1(0) = Cirkel1.center(0)
punt1(1) = Cirkel1.center(1)
punt1(2) = Cirkel1.center(2)
Else
MsgBox "Geen cirkel!"
GoTo Cirkel1
End If
'Duid de tweede cirkel aan
Cirkel2:
ThisDrawing.Utility.GetEntity retObj2, retPunt2, "Duid de tweede cirkel aan..."
'Controleer of het een cirkel is
If retObj2.ObjectName = "AcDbCircle" Then
Set Cirkel2 = retObj2
punt2(0) = Cirkel2.center(0)
punt2(1) = Cirkel2.center(1)
punt2(2) = Cirkel2.center(2)
Else
MsgBox "Geen cirkel!"
GoTo Cirkel2
End If
'rijboring in Y richting
If punt1(0) = punt2(0) Then
lengte = Abs(punt1(1) - punt2(1))
aantal = Round(((lengte - (minAfstand * 2)) / 32), 0)
afstand = ((lengte - (32 * aantal)) / 2)
If punt1(1) < punt2(1) Then
Yrichting punt1(0), punt1(1), afstand, aantal
Else
Yrichting punt2(0), punt2(1), afstand, aantal
End If
End If
'rijboring in X richting
If punt1(1) = punt2(1) Then
lengte = Abs(punt1(0) - punt2(0))
aantal = Round((lengte - (minAfstand * 2)) / 32)
afstand = ((lengte - (32 * aantal)) / 2)
If punt1(0) < punt2(0) Then
Xrichting punt1(0), punt1(1), afstand, aantal
Else
Xrichting punt2(0), punt2(1), afstand, aantal
End If
End If
End Sub
Sub Yrichting(xPunt As Double, yPunt As Double, afstand As Double, aantal As Double)
Dim rijboring As AcadCircle
Dim center(0 To 2) As Double
center(0) = xPunt
center(1) = yPunt
center(2) = 0
For i = 1 To aantal - 1
center(1) = yPunt + afstand + (32 * i)
Set rijboring = ThisDrawing.ModelSpace.AddCircle(center, 2.5)
Next i
End Sub
Sub Xrichting(xPunt As Double, yPunt As Double, afstand As Double, aantal As Double)
Dim rijboring As AcadCircle
Dim center(0 To 2) As Double
center(0) = xPunt
center(1) = yPunt
center(2) = 0
For i = 1 To aantal - 1
center(0) = xPunt + afstand + (32 * i)
Set rijboring = ThisDrawing.ModelSpace.AddCircle(center, 2.5)
Next i
End Sub
Citeer
@ Steven heb je een pm anders stuur ik u mijn code eens door.
Heb jij ook voor graduaat hout gestudeerd.
Sub Tekststijl()
Dim Tekststijl As AcadTextStyle
Dim Fontname As String
Dim charSet As Long
Dim PitchandFamily As Long
Fontname = "Tahoma"
charSet = 0
PitchandFamily = 34
Set Tekststijl = ThisDrawing.TextStyles.Add("hout vast")
Tekststijl.SetFont Fontname, False, False, charSet, PitchandFamily
Tekststijl.Width = 0.5
Tekststijl.Height = 4
End Sub
Citaat van: Joop op vr 07 07 2006, 09:23:29
Dit is dus wel een oplossing maar niet echt de goede.
Heb je al eens gekeken naar de gegevens van de UCS zoals die opgeslagen zijn in de tekening?
Deze zijn met VBA eenvoudig te wijzigen.
Sub Move_UCS()
Dim Ucs As AcadUCS
origin = ThisDrawing.Utility.GetPoint(, "Duid de oorsprong aan: ")
xAxisPnt = ThisDrawing.Utility.GetPoint(, "Duid een punt op de X-as aan: ")
yAxisPnt = ThisDrawing.Utility.GetPoint(, "Duid een punt op de Y-as aan: ")
Set Ucs = ThisDrawing.UserCoordinateSystems.Add(origin, xAxisPnt, yAxisPnt, "NEW_UCS")
ThisDrawing.ActiveViewport.UCSIconAtOrigin = True
ThisDrawing.ActiveViewport.UCSIconOn = True
ThisDrawing.ActiveUCS = Ucs
End Sub
Private Sub Move_Click()
Dim ssetOb As AcadSelectionSet
Dim Obj As AcadEntity
On Error Resume Next
Set ssetOb = ThisDrawing.SelectionSets.Item("ssetje")
If Err Then
Set ssetOb = ThisDrawing.SelectionSets.Add("ssetje")
Err.Clear
Else
ssetOb.Clear
End If
 Â
ssetOb.Select acSelectionSetAll
Dim punt1(1 To 3) As Double
Dim punt2(1 To 3) As Double
punt1(1) = 0: punt2(1) = 0
punt1(2) = 0: punt2(2) = Val(Txt2) + 500
For Each Obj In ssetOb
  Obj.Move punt1, punt2
 Â
Next
ssetOb.Delete
End Sub