Use Naviswork ActiveX with Licensed API

Use Naviswork ActiveX with Licensed API

Anonymous
Not applicable
4,824 Views
17 Replies
Message 1 of 18

Use Naviswork ActiveX with Licensed API

Anonymous
Not applicable

Hi,

 

I'm trying to use the Naviswork ActiveX with Licensed API for more capabilities, like selection and view functions.

 

According the COM Interface document it is possible:

 

 

Spoiler
ActiveX Licensing
If unlicensed the controls will open Navisworks 3 and later .nwd and .nwf files. The API is also limited for
an unlicensed control. To open .nwc files or use full API functionality additional licensing is required, this
requires one of :.
• An installed licensed copy of Navisworks to display any file.
• A suitable TeamWorker license file to display a file published by TeamWorker publisher. For internet
and intranet usage this could be on the server.
• A runtime license embeded in the container application.

 

I already have a Naviswork Manager 2011 License running, and i found that the Object can have a certificate atribute:

 

 

Spoiler
VBA Usage
Control name is 'nwControl'; or 'Navisworks'
‘ SRC’ property
This identifies the Navisworks file to be downloaded and opened.
‘Certificate’ property
This identifies the Navisworks license to be downloaded and opened.

‘State’ property
Gets access to the controls internal state.

The document don't explain what should be put inside the certificate property. I tried to put the address to the license file (.LIC), but it did't work, when pressing CTRL+ALT+SHIFT+E it still show UNLICENSED.

 

How can I use this?

 

 

 

 

 

 

0 Likes
4,825 Views
17 Replies
Replies (17)
Message 2 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

Hi potapczuk,

 
Can I know which type control you are using? CTRL+ALT+SHIFT+E can tell the information. In default, Lite or Full control has limited functionalities, even you have license of Navisworks product. Only the Dynamic (built-in) control is licensed.

 

lcodieS.dll: Lite control

lcodieDX.dll:  Full control

lcodieD.dll :   Dynamic control


Please note: from 2012, ActiveX controls are re-organized as Redistributable control (known as Full control before), and Integrated control (known as built-in control). Similarly, the Redistributable has limited functionalities until it has embedded license.

 

Best regards,

 
autodesk_logo_signature.png

Xiaodong Liang

Developer Consultant

Autodesk Developer Technical Services

 

0 Likes
Message 3 of 18

Anonymous
Not applicable

 


@xiaodong_liang wrote:

Hi potapczuk,

 
Can I know which type control you are using? CTRL+ALT+SHIFT+E can tell the information. In default, Lite or Full control has limited functionalities, even you have license of Navisworks product. Only the Dynamic (built-in) control is licensed.

 

lcodieS.dll: Lite control

lcodieDX.dll:  Full control

lcodieD.dll :   Dynamic control


Please note: from 2012, ActiveX controls are re-organized as Redistributable control (known as Full control before), and Integrated control (known as built-in control). Similarly, the Redistributable has limited functionalities until it has embedded license.

 

Best regards,

 
autodesk_logo_signature.png

Xiaodong Liang

Developer Consultant

Autodesk Developer Technical Services

 


 

Hi

 

How do we use the redistributable Control with an embedded license?

Do I use the integrated Control or the redistributable Control in Visual Studio?

 

I have tried using the Integrated control and distributing lcodieD.dll and running the ActiveX redistributable Setup but this fails.

I have tried using the redistributable control but some code fails like FindAll() with a Inavalid Licence error.

0 Likes
Message 4 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

>>How do we use the redistributable Control with an embedded license?

 

To use redistributable Control with an embedded license, I am not aware of a process for non-ADN members. Sorry.

 

>>Do I use the integrated Control or the redistributable Control in Visual Studio?

 

You can use integrated Control or the redistributable Control in Visual Studio.  

 

On 32bits, Toolbox>>Choose Items>> select the controls from the list under COM tab

 

please note, VS on 64bits is still 32bits. The designer on 64bits cannot load the 64bits control. So you would need to design your application on 32bits and copy to 64bits. The application will use 64bits control at runtime. Or you could design the layout of your application just by code (a bit inconvenient, though).

 

>>I have tried using the Integrated control and distributing lcodieD.dll and running the ActiveX redistributable Setup but this fails.

 

So you tried to distribute the application (with lcodieD.dll) to a target machine without Navisworks installed? As mentioned, lcodieD.dll (Integrated control) requires Navisworks installed. It is NOT free for distribution.

 

>>I have tried using the redistributable control but some code fails like FindAll() with a Invalid License error.

 

Yes, I have mentioned the API functionalities are limited with redistributable control. FindAll is not supported.

 

Best regards, 

 Autodesk.JPG

Xiaodong Liang

Developer Consultant

Autodesk Developer Technical Services

 

 

0 Likes
Message 5 of 18

Anonymous
Not applicable

To use redistributable Control with an embedded license, I am not aware of a process for non-ADN members. Sorry.

 

So, if we become ADN members, do we get access to OEM agreement/Active X license (icodiedx.dll)?

Can you give me steps to apply for ADN/get license?

 

Regards

Andrew

 

0 Likes
Message 6 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

Hi Andrew,

 

Sorry for my late response.

 

to apply for ADN, please visit the site:  http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=723353 

 

As to the OEM, I got to know it is not currently commercially available. However becoming an ADN will have more other  benifits. The link above tells more.

 

Best regards,

 
autodesk_logo_signature.png

Xiaodong Liang

Developer Consultant

Autodesk Developer Technical Services

0 Likes
Message 7 of 18

Anonymous
Not applicable

Is there an older version of Navisworks Manage that we can purchase which is before the new OEM licensing?

 

We know of companies that are running an older ActiveX control with full functionality without the need for end user customer to have Navisworks installed.

How did they achieve this? Can we do the same?

 

0 Likes
Message 8 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

Unfortunately, I have not an information. What I know is: the new OEM license is not available currently and integrated controls is the way out but it requires prior installation in the target machines, in order to have full API abilities.

 

I guess those companies who got license may be some prior agreements. I have not an information about it. Sorry.

 

 

Best regards,

 
autodesk_logo_signature.png

Xiaodong Liang

Developer Consultant

Autodesk Developer Technical Services

0 Likes
Message 9 of 18

bbrown
Advocate
Advocate

 

Yes, I have mentioned the API functionalities are limited with redistributable control. FindAll is not supported.

 

 

 



Is there a list of what functionality is limited? Loading the dll into VS gives me all the same commands as the intergrated version, but some things throw API Unlicensed error. (Like NWControl01.state.CurrentPartition.ObjectName)

0 Likes
Message 10 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

Sorry, we have not a list of un-supported API.


It is recommended to use Integrated Control, at least in the stage of your investigation/evaluation. And port it to Redistributable control to see what methods are not supported. Thus you will know which methods are necessary if you want to use Redistributable control.


 

Best regards,

 
autodesk_logo_signature.png

Xiaodong Liang

Developer Consultant

Autodesk Developer Technical Services

0 Likes
Message 11 of 18

Anonymous
Not applicable

I have problems with the API unlicensed issue as well. Currently I have both 2009 and 2011 versions installed (Windows 7 32b.). No matter what control I use (Lite or Dynamic), 2009 or 2011 I encounter this problem.

The control appears in IE, but the model is not displayed, and calling methods or properties throws this error.

Pressing Ctrl+Alt+Shift+E gives

(API=UNLICENSED, lcodieD.dll, Version=fix.6.0.46140 or Version=fix.8.0.60144).

I try it on the first COM example (ACTX_01.html).

 

Interestingly, when I open a web page which has our ActiveX control embedded (this ActiveX control contains the 2009 Dynamic control - lcodieD.dll Version=fix.6.0.46140 API=LICENSED), it shows properly and works.

 

I also tried to add the 2011 Dynamic control to a UserForm, which is part of an Excel Visual Basic project I created, it works properly as well.

 

I have encountered this API unlicensed problem before and  it always disappeared by itself.

 

Is there more information about this issue?

0 Likes
Message 12 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

It was a problem the model file is not loaded in AXTC_01 sample before 2012. The reason is: the relative path on client does not work. i.e. if the HTML locates on client and uses relative path to open the model, it does not work. If the HTML locates on the server, relative path can work. This problem is solved in 2012 controls.

 

>> I have encountered this API unlicensed problem before and it always disappeared by itself

  

  I am not clear what you meant. The only scenario I can image why the unlicensed API error disappeared is: your code actually uses dynamic/integrated control.

 

 

Regards,

Xiaodong Liang

Developer Technical Services

0 Likes
Message 13 of 18

Anonymous
Not applicable

Right now I am experiencing the problem. If I use the control in web page (located locally on my HDD), the control does not appear. I tried both Lite and Dynamic versions of 2011 control (I have changed the CLSID if ACTX_01.html (it is a COM example) from 5E522D92-AED8-47ff-9AB6-DDA03592D660 (i.e. Lite control) to CB9008E4-D829-4d4d-B84B-8291365E5CDF (i.e Dynamic control), but the control does not appear in the web page.

I also tried to add full path instead relative (changed ..\gatehouse.nwd to C:\Program Files\.....\gatehouse.nwd).

 

When I instantiate the control on UserForm (in Excel VBA), it works correctly (I use the Dynamic control).

But it is not the most pressing problem.

 

My query is : is it possible to implement functionality of Custom Selections in web page using Javascript or VBScript?

The method SeekSelection requires a InwSeekSelection implementing class as its second parameter. Such class has to implement the SelectNode method.

But as I have tried, it is impossible to do in a web page using either Javascript or VBScript. The SelectNode method has four parameters and the last two are supplied by reference, which puts Javascript out of the question. Even VBScript does not work.

I would just be grateful, if someone could confirm, that creating Selections this way is impossible.

 

0 Likes
Message 14 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

1. Control does not appear
>>The web page is empty?
If yes, check in the registry if the control has been installed.
Check if you are testing on 64bits machine. The web page of 64bits Dynamic control can only be opened by IE-64bits

 

>>The control is loaded, but the screen of the control is black?
Before 2012, there is an issue with the relative path if the webpage is located locally on your machine. It is fixed since in 2012. And absolute path should always work.
Check if the viewpoint is not appropriate. Zoom all to see if you can see the model.


2. InwSeekSelection is a callback class. As far as I know, it may be hard/impossible to use callback class. But I found some links on internet on the topic. you may need to consult with the expert of VBS or JS.

http://knowledgeinbox.com/articles/vbscript/implementing-callback-in-vbscript/

 

Except InwSeekSelection, you can use Find API of Navisworks to search the selection as below. Or you have to traverse the model, get the objects you are interested in with some conditions, to create the selection.

 

<script type="text/javascript">
function test(){

var state = ctrlId.state;
var find = state.ObjectFactory(state.GetEnum("eObjectType_nwOpFind"));
var findspec = state.ObjectFactory(state.GetEnum("eObjectType_nwOpFindSpec"));
var findcon = state.ObjectFactory(state.GetEnum("eObjectType_nwOpFindCondition"));

findcon.SetPropertyNames("LcOaNat64AttributeValue");
findcon.SetAttributeNames("LcOpDwgEntityAttrib");
findcon.Condition = state.GetEnum("eFind_EQUAL");
findcon.value = "16C17";

findspec.Selection.SelectAll();
findspec.Conditions().add(findcon);
find.FindSpec = findspec;
var sel = find.FindAll();
state.CurrentSelection = sel;
state.ZoomInCurViewOnCurSel();

}

0 Likes
Message 15 of 18

Anonymous
Not applicable

First of all, thank you for your effort. I have read the article about callback in VBScript. Very interesting. I have also tried your code in VB6, but have not succeded. I believe that I use incorrect property names or attribute names. I need to select the item based on its UserName (InwOaNode.UsernName).

Public Sub findName(ByRef psName As String)

    Dim loFind          As NavisworksAPI8Ctl.InwOpFind
    Dim loFindCon       As NavisworksAPI8Ctl.InwOpFindCondition
    Dim loFindSpec      As NavisworksAPI8Ctl.InwOpFindSpec
    Dim loFoundSel      As NavisworksAPI8Ctl.InwOpSelection2
    
    Set loFind = nwCtl.State.ObjectFactory(eObjectType_nwOpFind)
    Set loFindSpec = nwCtl.State.ObjectFactory(eObjectType_nwOpFindSpec)
    Set loFindCon = nwCtl.State.ObjectFactory(eObjectType_nwOpFindCondition)
    
    
    loFindCon.SetPropertyNames "LcOaNameAttributeValue"
    loFindCon.SetAttributeNames "LcOaNode"
    loFindCon.Condition = eFind_EQUAL
    loFindCon.Value = psName
    
        
    loFindSpec.selection.SelectAll
    loFindSpec.Conditions().Add loFindCon
    loFind.FindSpec = loFindSpec
    
    Set loFoundSel = loFind.FindAll()
    
    nwCtl.State.CurrentSelection = loFoundSel

End Sub

 This doesn't find anything.

After many hours of trial and error I developed a working code, which should work in JavaScript as well. But the code you have suggested is perphaps faster, so using it might be better in the long way.

Private Function selectItem(ByRef psName As String) As Boolean
    On Error GoTo ERR_DEF_HANDLER
    
    Dim loSel               As InwOpSelection2
    Dim loSelPathNodesColl  As InwSelectionPathsColl
    Dim loPath3             As InwOaPath3
    Dim loNode              As InwOaNode
    Dim loPart3             As InwOaPartition3
    Dim loFoundNode         As InwOaNode
    Dim loO                 As Object
    Dim loParents           As Collection
    Dim i                   As Integer
    
    
    Set loSel = nwCtl.State.ObjectFactory(eObjectType_nwOpSelection)
    loSel.SelectAll
    Set loPaths = loSel.Paths()
    Set loPath = loPaths.Item(1)
    Set loNodesColl = loPath.Nodes()
    Set loNode = loNodesColl.Item(1)
    Set loPart3 = loNode
    Set loNodeNodes = loPart3.Children()
    
    If (loNodeNodes.Count > 0) Then
        Set loFoundNode = getNodeWithinNode(loNodeNodes, psName)
        If (loFoundNode Is Nothing = False) Then
            Set loNode = loFoundNode
            Set loParents = New Collection

            
            For i = 1 To loFoundNode.Fragments().Item(1).path.Nodes().Count
                loParents.Add loFoundNode.Fragments().Item(1).path.Nodes().Item(i)
            Next i
            
            Set loSel = nwCtl.State.ObjectFactory(eObjectType_nwOpSelection)
            Set loPath3 = nwCtl.State.ObjectFactory(eObjectType_nwOaPath)
            
            Dim loParentNode As InwOaNode
            For i = 1 To loParents.Count()
                Set loO = loParents.Item(i)
                Call loPath3.Nodes().Add(loO)
                If (loO.UserName = psName) Then
                    Exit For
                End If
            Next i
            
            Call loSel.Paths().Add(loPath3)
            
            nwCtl.State.CurrentSelection = loSel
            selectItem = True
            Exit Function
        End If
    End If
    
ERR_DEF_HANDLER:
    
    selectItem = False
    

End Function

Private Function getNodeWithinNode(ByVal poNodeNodesColl As InwNodeNodesColl, ByRef psNodeName As String) As InwOaNode
    
    Dim loChild         As Object '
    Dim loChildGroup    As InwOaGroup '
    Dim loChildFrag     As InwOaFragment3
    Dim loChildGeom     As InwOaGeometry '
    Dim loSoughtNode    As InwOaNode
    Dim i               As Integer
    
    
    If (poNodeNodesColl.Count > 0) Then
        For i = 1 To poNodeNodesColl.Count
            Set loChild = poNodeNodesColl.Item(i)
            If (TypeOf loChild Is NavisworksAPI8Ctl.InwOaGroup) Then
                Set loChildGroup = loChild
                Set loNode = loChildGroup
                If (loChildGroup.UserName = psNodeName) Then
                    Set getNodeWithinNode = loChildGroup
                    Exit Function
                Else
                    Set loSoughtNode = getNodeWithinNode(loChildGroup.Children(), psNodeName)
                    If (loSoughtNode Is Nothing = False) Then
                        Set getNodeWithinNode = loSoughtNode
                        Exit Function
                    End If
                End If
            ElseIf (TypeOf loChild Is NavisworksAPI8Ctl.InwOaGeometry) Then
                Set loChildGeom = loChild
                If (loChildGeom.UserName = psNodeName) Then
                    Set getNodeWithinNode = loChildGeom
                    Exit Function
                End If
            End If
        Next i
        Set getNodeWithinNode = Nothing
    End If

End Function

 The problem is that while the control (Dynamic, CLSID : CB9008E4-D829-4D4D-B84B-8291365E5CDF in C:\Program Files\Autodesk\Navisworks Simulate 2011\lcodieD.dll) works flawlessly in VB6, it doesn't appear on a webpage.  When I open the webpage, the control doesn't show at all.

I believe that the control is installed and registered corretly. The functionality within Visual Studio 6 (or in VBA designer in Excel) supports it.

I have used ActiveXHelper, which is part of NirSoft Utilities, and it shows it correctly. I have not look it up in the registry, as the ActiveXHelper does it.

 

I have a 32 bit Windows 7, so 64 bit issue is not the case.

 

Any suggestion what might be wrong is welcomed.

0 Likes
Message 16 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

no idea why the control did not appear in  your web application. if the machine has VB6/VS installed, have you checked ToolBox-->Components if Navisworks Dynamic Control is listed there? can you place it to the application? i.e. can you see the control with a VB6/VS application?

 

if this works, that means the control is OK. (something like what you did by ActiveXHelper ). Thus probably it is better to provide a sample project of the web application to diagnose.

0 Likes
Message 17 of 18

Anonymous
Not applicable

I think that I mentioned it earlier, that it happened to me already. Again, the control somehow fixed itself and it now appears correctly. The code I have mentioned above works using javascript as well. I only wonder, what parameters I would have to use if I wanted to use the code you suggested if I wanted to make the selection based on UserName property of InwOaNode.

 

var find = state.ObjectFactory(state.GetEnum("eObjectType_nwO​pFind"));
var findspec = state.ObjectFactory(state.GetEnum("eObjectType_nwO​pFindSpec"));
var findcon = state.ObjectFactory(state.GetEnum("eObjectType_nwO​pFindCondition"));

findcon.SetPropertyNames(​?);
findcon.SetAttributeNames(?);
findcon.Condition = state.GetEnum("eFind_EQUAL");
findcon.value = "my value I create selection for";

 

The only problem that remains is, that the control does not load other models. The first model loads by using the

 

<PARAM NAME="SRC" VALUE="C:\Users\borkovec\Documents\800_01#A018_1.nwc">

 

but when I try to add another model like this:

 

nwControl.AppendFile("C:\Users\borkovec\Documents\800_01#A019_1.nwc");

 

nothing happens.

I also try to open another file like this

 

nwControl.src="C:\Users\borkovec\Documents\800_01#A019_1.nwc";

 

or

nwControl.SRC_As("C:\Users\borkovec\Documents\800_01#A019_1.nwc", nwControl.State.GetEnum("eFileType_NWC"));

 

but the model does not change, although the nwControl.SRC property changes to the new file.

 

I have no idea why, because when I use the same code in Visual Studio 6, it works perfectly.

 

Any suggestion is appreciated.

0 Likes
Message 18 of 18

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

The methods of Find SetAttributeNames and SetPropertyNames depend on which attribute/property you want to search. Their first argument is the internal name of the attribute/property. The second is the display name. I believe you have checked the SDK sample \api\COM\examples\ACTX_05 which demos the usages of Find with various search conditions. In addition, the sample AUTO_06 dumps the attributes & properties. So for your case, you can select an object and dumps its information. Thus you could know how to fill in the arguments of those two methods. Hope this answered.

 

As to the problem of displaying some specific nwc file, you would need to provide a reproducible sample. I may take a look what is wrong with it.

0 Likes