DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Access Violation 0003C3DA DIAView.dll: Remove method not working

Solved!
Go to solution

The above problem has just appeared when running a script for the first time (on my machine) in DIAdem 2021, having worked perfectly in 2020.

 

The offending line of code (not the one in the error message but the one at which the problem actually occurs) is:

Call View.Sheets("Sheet 1").Areas("Area : 1").DisplayObj.Curves.Add("[1]/[1]","[1]/[6]")

...but this is only the problem line because of what takes place just prior. Having started with two groups of channels, the code deletes the first group as it is not needed any more. The second group becomes the first group and channels 1 and 6 are to be plotted using the above line.

 

However, what seems to be happening is at the point of deleting the first group the data file is not updated so that the above line tries to add channels 1 and 6 from the first group. These are now empty and not available, although the group and channels still appear to be listed in the portal.

 

As I write this I've also discovered that previous channel deletions also fail in the same manner. The two 'Time' channels in the following image should have been removed before any of the above takes place. I've shown the 'Latac' channel in the first group as highlighted but you can see in the boxes below there are no details for that channel.

 

Simon_Aldworth_0-1649076167476.png

 

In short, it seems that using the Remove method is not working properly.

 

Regards, Simon.

0 Kudos
Message 1 of 7
(1,477 Views)

Hi Simon,

 

I have tested the behavior which you described in DIAdem 2021 SP1. It works fine. Here is my script and attached, also all other data. Can you please check the problem with these data?

 

all Data.Root.Clear
call DataFileLoad(CurrentScriptPath & "Test Data.TDM")
call View.LoadLayout(CurrentScriptPath & "Test Data.TDV")

call Data.Root.ChannelGroups.Remove(1)

call View.Sheets("Sheet 1").Areas("Area : 1").DisplayObj.Curves2D.Add("[1]/[1]", "[1]/[4]")

call WndShow("VIEW", "maximize")

 

Greetings

Walter

0 Kudos
Message 2 of 7
(1,450 Views)

Hi Walter,

 

Your code works perfectly.

 

Separately, I have engaged NI technical support to look at the problem so I will report back here with their findings.

 

Interestingly, if I run the problem script on its own (without being called using ScriptStart) then the same problem occurs. However, if I run it in debug mode then the Remove method works. But, when it comes to the line to add the 2D curve I get a slightly different error message stating that "The server threw an exception". What server, I wonder??

 

Thanks for your help and I'll let you know what they find.

 

Regards.

0 Kudos
Message 3 of 7
(1,441 Views)

Hi Simon,

 

We need to reproduce the problem so that we can find a solution. I think this is best done with your script code (at least the relevant code).

Do you work with DIAdem 2021 SP1?

 

Greetings

Walter

0 Kudos
Message 4 of 7
(1,434 Views)

Hi Walter,

 

I have submitted my code to NI tech support and they have confirmed that the problem is not with my code or installation - they have been able to replicate the problem themselves.

 

It's been escalated and I await their response.

 

Yes, I am using DIAdem 2021 SP1.

 

Regards.

0 Kudos
Message 5 of 7
(1,420 Views)
Solution
Accepted by Simon_Aldworth

Hi Simon,

This is a bug with deleting a VIEW area. It is independent of the data. You can reproduce it with this small script below. Luckily there is a workaround by only setting the area to be deleted as active area. The bug will be fixed in DIAdem 2022 SP1.

 

Call Data.Root.Clear()
call DataFileLoad("Example.TDM")

Call View.NewLayout()
dim oSheet_1 : set oSheet_1 = View.ActiveSheet
dim oArea_1 : set oArea_1 = oSheet_1.Areas(1)
dim oArea_2 : set oArea_2 = oArea_1.SplitBottom("Area : 2",0.5)

oArea_1.DisplayObjType = "CurveChart2D"
oArea_2.DisplayObjType = "CurveChart2D"

' workaround begin 
oArea_2.Active = true
' workaround end

oSheet_1.Areas.Remove(oArea_2.Name)

 

Greetings

Walter

0 Kudos
Message 6 of 7
(1,411 Views)

That's great, thanks Walter.

 

Regards.

0 Kudos
Message 7 of 7
(1,405 Views)