Hi, I want to be able to insert a block using vb.net and rotate that block during insertion, while being able to see what the rotation would look like.
The old Macro we used to do this was this *^C^C(command "layer" "m" "CSVGSYM" "ltype" "continuous" "" "color" "150" "" "")(command "insert" "221" "S" msf (getpoint))
This would insert the block on the layer and allow the user to rotate it after picking the insertion point, showing the user what the rotation would look like.
If I use this:
acedPostCommand("(command ""layer"" ""m"" ""CSVGSYM"" ""ltype"" ""continuous"" """" ""color"" ""150"" """" """") ")
acedPostCommand("(command ""insert"" ""221"" ""S"" msf (getpoint))")
It works properly but I cannot put it in a loop as it does not wait for a user response before looping again.
If I put it in a loop like this the problem is that I don't get to see what the rotated image would look while selecting the rotation angle.
Code:
insertRotatedBlock("X:\\Blocks\\221.dwg", "CSVGSYM", 150, "continuous")
Private Sub insertRotatedBlock(location As String, layer As String, color As String, linetype As String)
ThisDrawing = CType(Autodesk.AutoCAD.ApplicationServices.DocumentExtension.GetAcadDocument(Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument), Autodesk.AutoCAD.Interop.AcadDocument)
Dim tempBlock As AcadBlockReference
Dim userPoint As Object
Do
Try
userPoint = ThisDrawing.Utility.GetPoint(, "Specify insertion point:")
checkNewLayer(layer, color)
tempBlock = ThisDrawing.ModelSpace.InsertBlock(userPoint, location, (drawingSetting.getScale() / 1000), (drawingSetting.getScale() / 1000), (drawingSetting.getScale() / 1000), ThisDrawing.Utility.GetAngle(userPoint, "Select Rotation Angle: "))
tempBlock.Layer = layer
tempBlock.Linetype = linetype
Catch ex As System.Runtime.InteropServices.ExternalException
Exit Do
Catch exs As Exception
Exit Do
End Try
Loop
End Sub
Any help would be appreciated, thanks