Crash on vla-put-ActivePViewport

Hello,
I'm transferring an application from AutoCAD to Bricscad and I encounter a bug.
I have a command that generates many layouts with Pviewport.
This command switches between layouts, clears the contents of the layout and create lines and texts.
It defaults to the printer (Print as pdf.pc3 and paper size).
On first run no problem.
But on the second run, Bricscad crashes on the first Pviewport activation.
Here is a piece of the code I'm using.

(setq papier (vla-get-Paperspace (vla-get-ActiveDocument (vlax-get-Acad-object))))
...
(setq fen (vla-AddPViewport papier (vlax-3D-point ptmil) largeur hauteur))
(vla-display fen :vlax-true)
(vla-put-viewporton fen :vlax-true)
(vla-update fen)
(vla-regen (vla-get-activedocument (vlax-get-acad-object)) acAllViewports)
(vla-put-mspace (vla-get-activedocument (vlax-get-acad-object)) :vlax-true)
(vla-put-ActivePViewport (vla-get-activedocument (vlax-get-acad-object)) fen) ;; this line create crash

It seems that the Pviewport is not active despite my activations. i'm sure that the Pviewport is visible on screen and the Pviewport in on an active Layer.
If someone has an idea.
thanks

Comments

  • I found the problem. in the program, i redefine a block with (command). and after Bricscad makes some bug.