Recommended Posts

Posted

Cześć, zauważyłem kolejny błąd w ZWCAD, proszę o pomoc w możliwościach.

Napisałem sobie taki prosty kod ze wstawieniem bloku. Blok posiada okrąg i atrybuty. Zauważyłem, że po kolejnym wstawieniu bloku lokalizacja względem obiektu - kwadrant koła - przestaje działać na bloku. Wszystko przedstawia poniższy filmik. Kod:

Private Sub CommandButton1_Click()
UserForm1.hide
Dim BlockRef As ZcadBlockReference
Dim BlockAttributes As Variant
Dim PIERWSZY As Variant
Dim FileToInsert As String

PIERWSZY = ThisDrawing.Utility.GetPoint(, "Podaj punkt P1")
FileToInsert = "C:\e-cad\e-cad Zelbet Stal Drewno\Bloki\Opisy\e-cad_ZelbetOpis_7.dwg"
Set BlockRef = ThisDrawing.ModelSpace.InsertBlock(PIERWSZY, FileToInsert, 1, 1, 1, 0)
  BlockAttributes = BlockRef.GetAttributes
  BlockAttributes(0).TextString = "blok"
BlockRef.Update
Exit Sub
End Sub

(W kodzie dodałem na końcu Exit Sub, bo myślałem, że obiekt gdzieś wiruje w tle ale to nic nie dało. W filmiku tego Exit Sub nie było)

Filmik: 

http://cloud.movavi.com/show/47b0ff05-a0a5-4862-8df1-0a48f3990d14

  • 1 month later...
Posted

Otrzymałem informacje z ZWSoft myśl których w kodzie po

BlockRef.Update

potrzebne jest dodanie

Dim ent  As ZcadEntity
Dim blkref As ZcadBlockReference
For Each ent In ThisDrawing.ModelSpace
	If TypeOf ent Is ZcadBlockReference Then
        Set blkref = ent
        If blkref.Name = "e-cad_ZelbetOpis_7" Then
	        ent.Update
        End If
    End If
Next

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now