- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello. I am here trying to make a code where you put in data like width, length, how many and setera. Like in the photo.
And i wanted to
1. Change line type and color, but option Set is not allowing me to make any it always glowing red in code.
2. So every cube had it own personal sequenced number but i have no formula for that so i wiil need to change my code.
3. I suppose AcadLine and other acad types are not working or not get registered.
Here is the code because i cannot upload dvb files.
Private Sub DrawRectangle_Click()
Dim starter, pt1, pt2, pt3, pt4, vectorup, bluestart, blueend, redstart, redend, name As Variant
Dim textObj As Variant
Dim i, j, cap1, cap2, distanceright, distanceup As Integer
Dim pi As Double
Dim blue, red As Variant
UserForm1.Hide
pi = 3.14
cap1 = Val(TextBox3.Text)
cap2 = Val(TextBox4.Text)
distanceright = Val(TextBox1.Text) + Val(TextBox5.Text)
distanceup = Val(TextBox2.Text) + Val(TextBox5.Text)
UserForm1.Hide
starter = ThisDrawing.Utility.GetPoint(, "Pick left starter corner")
vectorup = starter
For j = 1 To cap2
vectorup = ThisDrawing.Utility.PolarPoint(starter, pi / 2, distanceup * (j - 1))
For i = 1 To cap1
pt1 = ThisDrawing.Utility.PolarPoint(vectorup, 0, distanceright * (i - 1))
pt2 = ThisDrawing.Utility.PolarPoint(pt1, 0, Val(TextBox1.Text))
pt3 = ThisDrawing.Utility.PolarPoint(pt2, pi / 2, Val(TextBox2.Text))
pt4 = ThisDrawing.Utility.PolarPoint(pt1, pi / 2, Val(TextBox2.Text))
ThisDrawing.ModelSpace.AddLine pt1, pt2
ThisDrawing.ModelSpace.AddLine pt2, pt3
ThisDrawing.ModelSpace.AddLine pt3, pt4
ThisDrawing.ModelSpace.AddLine pt4, pt1
bluestart = ThisDrawing.Utility.PolarPoint(pt1, pi / 4, Sqr((Val(TextBox1.Text) / 4) ^ 2 + (Val(TextBox2.Text) / 10) ^ 2))
blueend = ThisDrawing.Utility.PolarPoint(bluestart, pi / 2, Val(TextBox2.Text) * 9 / 10 + Val(TextBox5.Text) * 6 / 10)
ThisDrawing.ModelSpace.AddLine bluestart, blueend
redstart = ThisDrawing.Utility.PolarPoint(pt3, 5 * pi / 4, Sqr((Val(TextBox1.Text) / 4) ^ 2 + (Val(TextBox2.Text) / 10) ^ 2))
redend = ThisDrawing.Utility.PolarPoint(redstart, pi / 2, Val(TextBox2.Text) / 10 + Val(TextBox5.Text) * 4 / 10)
ThisDrawing.ModelSpace.AddLine redstart, redend
name = ThisDrawing.Utility.PolarPoint(pt1, pi / 4, Sqr((Val(TextBox1.Text) / 2) ^ 2 + (Val(TextBox2.Text) / 2) ^ 2))
ThisDrawing.ModelSpace.AddText TextBox8.Text & Val(TextBox9.Text) + i + j - 2, name, Val(TextBox2.Text) / 10
Next i
Next j
End Sub
Solved! Go to Solution.