|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
API NewbieI am new to API programming. I am trying to write the information of a property page of a file to another file. For instance, the property page of a file has the information already filled in by the user within a program that they used. I want to copy some of the fields to another file (property page). The software we are using is Inventor (similar to AutoCAD). From what I understood, the software is making the APIs available for use, but I don't know how to access it. Do I have to write the codes to access the API's (to get it to list the API) or can I use the object browser in Visual Basic. It seems that the API listed are not that much if I use the object browser in Visual Basic. I am reading that the APIs are made available. Any help would be appreciated. Do I take the approach of writing it within the program or outside of it? You can see the details of the property page through windows explorer by right clicking it. Btw, the Inventor software has a Visual Basic Editor and Macros built inside. Thanks, Tony I'm guessing you are referring to API functions of the vendor's DLLs.
You'll need to know the functions and how they're declared and used. I suggest contacting the vendor or pouring through any documentation they provided. <trac***@gmail.com> wrote in message Show quoteHide quote news:1127500111.996236.117660@g14g2000cwa.googlegroups.com... > Guys, > > I am new to API programming. I am trying to write the information of a > property page of a file to another file. > > For instance, the property page of a file has the information already > filled in by the user within a program that they used. I want to copy > some of the fields to another file (property page). > > The software we are using is Inventor (similar to AutoCAD). From what > I understood, the software is making the APIs available for use, but I > don't know how to access it. > > Do I have to write the codes to access the API's (to get it to list > the API) or can I use the object browser in Visual Basic. It seems > that the API listed are not that much if I use the object browser in > Visual Basic. I am reading that the APIs are made available. Any help > would be appreciated. > > Do I take the approach of writing it within the program or outside of > it? You can see the details of the property page through windows > explorer by right clicking it. > > Btw, the Inventor software has a Visual Basic Editor and Macros built > inside. > > > Thanks, > Tony > I have some code samples showing the use of the API's from Mechanical
Desktop (might be one Inventor code sample too). Use this as a guide.. Link: http://www.veign.com/vrc_app_cat.asp?catid=7 -- Show quoteHide quoteChris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp Veign's Blog http://www.veign.com/blog -- <trac***@gmail.com> wrote in message news:1127500111.996236.117660@g14g2000cwa.googlegroups.com... > Guys, > > I am new to API programming. I am trying to write the information of a > property page of a file to another file. > > For instance, the property page of a file has the information already > filled in by the user within a program that they used. I want to copy > some of the fields to another file (property page). > > The software we are using is Inventor (similar to AutoCAD). From what > I understood, the software is making the APIs available for use, but I > don't know how to access it. > > Do I have to write the codes to access the API's (to get it to list > the API) or can I use the object browser in Visual Basic. It seems > that the API listed are not that much if I use the object browser in > Visual Basic. I am reading that the APIs are made available. Any help > would be appreciated. > > Do I take the approach of writing it within the program or outside of > it? You can see the details of the property page through windows > explorer by right clicking it. > > Btw, the Inventor software has a Visual Basic Editor and Macros built > inside. > > > Thanks, > Tony > Guys,
Below is my current code. The code writes a value to a field in the current active document. Instead of writing the value to the current field (assuming the field value is there already), how can I make it read that field's value from the active document and write the value to a file that is not currently active (sitting in the background within the program which is located in c:\temp). Btw, the API unique name is the same on both pages. Public Sub Test3() ' Declare the Application object Dim oApplication As Inventor.Application ' Obtain the Inventor Application object. ' This assumes Inventor is already running. Set oApplication = GetObject(, "Inventor.Application") ' Set a reference to the active document. ' This assumes a document is open. Dim oDoc As Document Set oDoc = oApplication.ActiveDocument ' Obtain the PropertySets collection object Dim oPropsets As PropertySets Set oPropsets = oDoc.PropertySets ' Get a reference to the "Date Checked" property. Dim oProp As Property Dim PartNum As String Set oProp = oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kStockNumberDesignTrackingProperties) ' Define a Date variable with the desired date. PartNum = "9836-scoobie1" ' Assign the date to the property. oProp.Value = PartNum End Sub Thanks in advance, Tony No idea (and most would not in this newsgroup)...Try one of the many
Autodesk newsgroups -- Show quoteHide quoteChris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp Veign's Blog http://www.veign.com/blog -- <trac***@gmail.com> wrote in message news:1127762449.769413.182900@o13g2000cwo.googlegroups.com... oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kStock> Guys, > > Below is my current code. The code writes a value to a field in the > current active document. > > Instead of writing the value to the current field (assuming the field > value is there already), how can I make it read that field's value > from the active document and write the value to a file that is not > currently active (sitting in the background within the program which is > located in c:\temp). Btw, the API unique name is the same on both > pages. > > > Public Sub Test3() > ' Declare the Application object > Dim oApplication As Inventor.Application > > ' Obtain the Inventor Application object. > ' This assumes Inventor is already running. > Set oApplication = GetObject(, "Inventor.Application") > > ' Set a reference to the active document. > ' This assumes a document is open. > Dim oDoc As Document > Set oDoc = oApplication.ActiveDocument > > ' Obtain the PropertySets collection object > Dim oPropsets As PropertySets > Set oPropsets = oDoc.PropertySets > > > ' Get a reference to the "Date Checked" property. > Dim oProp As Property > Dim PartNum As String > > Set oProp = > NumberDesignTrackingProperties) Show quoteHide quote > > ' Define a Date variable with the desired date. > > PartNum = "9836-scoobie1" > > ' Assign the date to the property. > oProp.Value = PartNum > > End Sub > > Thanks in advance, > Tony > Chris,
I am just trying to find sample codes that read the value. I already have the codes on how to write to the field. Its been a while I wrote VB(A), but i guess I have to use the Until Loop to go the API. Thanks, Tony Veign wrote: Show quoteHide quote > No idea (and most would not in this newsgroup)...Try one of the many > Autodesk newsgroups > > -- > Chris Hanscom - Microsoft MVP (VB) > Veign's Resource Center > http://www.veign.com/vrc_main.asp > Veign's Blog > http://www.veign.com/blog > -- > > > <trac***@gmail.com> wrote in message > news:1127762449.769413.182900@o13g2000cwo.googlegroups.com... > > Guys, > > > > Below is my current code. The code writes a value to a field in the > > current active document. > > > > Instead of writing the value to the current field (assuming the field > > value is there already), how can I make it read that field's value > > from the active document and write the value to a file that is not > > currently active (sitting in the background within the program which is > > located in c:\temp). Btw, the API unique name is the same on both > > pages. > > > > > > Public Sub Test3() > > ' Declare the Application object > > Dim oApplication As Inventor.Application > > > > ' Obtain the Inventor Application object. > > ' This assumes Inventor is already running. > > Set oApplication = GetObject(, "Inventor.Application") > > > > ' Set a reference to the active document. > > ' This assumes a document is open. > > Dim oDoc As Document > > Set oDoc = oApplication.ActiveDocument > > > > ' Obtain the PropertySets collection object > > Dim oPropsets As PropertySets > > Set oPropsets = oDoc.PropertySets > > > > > > ' Get a reference to the "Date Checked" property. > > Dim oProp As Property > > Dim PartNum As String > > > > Set oProp = > > > oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kStock > NumberDesignTrackingProperties) > > > > ' Define a Date variable with the desired date. > > > > PartNum = "9836-scoobie1" > > > > ' Assign the date to the property. > > oProp.Value = PartNum > > > > End Sub > > > > Thanks in advance, > > Tony > > Just because you are writing code in VB(A) doesn't mean the code is native
VB(A) code. The applications that host VBA create their own libraries and expose methods, properties, and events that are specific to the host application. This is why you should be asking in a newsgroup geared towards the host application and not VB(A)... If you don't want to take my advice, that's fine. Keep waiting here for an answer.... (4th time I have responded to one of your API questions) -- Show quoteHide quoteChris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp Veign's Blog http://www.veign.com/blog -- <trac***@gmail.com> wrote in message news:1127798780.601641.253250@g43g2000cwa.googlegroups.com... oPropsets.Item("{32853F0F-3444-11d1-9E93-0060B03C1CA6}").ItemByPropId(kStock> Chris, > > I am just trying to find sample codes that read the value. I already > have the > codes on how to write to the field. > > Its been a while I wrote VB(A), but i guess I have to use the Until > Loop to go the API. > > Thanks, > Tony > Veign wrote: > > No idea (and most would not in this newsgroup)...Try one of the many > > Autodesk newsgroups > > > > -- > > Chris Hanscom - Microsoft MVP (VB) > > Veign's Resource Center > > http://www.veign.com/vrc_main.asp > > Veign's Blog > > http://www.veign.com/blog > > -- > > > > > > <trac***@gmail.com> wrote in message > > news:1127762449.769413.182900@o13g2000cwo.googlegroups.com... > > > Guys, > > > > > > Below is my current code. The code writes a value to a field in the > > > current active document. > > > > > > Instead of writing the value to the current field (assuming the field > > > value is there already), how can I make it read that field's value > > > from the active document and write the value to a file that is not > > > currently active (sitting in the background within the program which is > > > located in c:\temp). Btw, the API unique name is the same on both > > > pages. > > > > > > > > > Public Sub Test3() > > > ' Declare the Application object > > > Dim oApplication As Inventor.Application > > > > > > ' Obtain the Inventor Application object. > > > ' This assumes Inventor is already running. > > > Set oApplication = GetObject(, "Inventor.Application") > > > > > > ' Set a reference to the active document. > > > ' This assumes a document is open. > > > Dim oDoc As Document > > > Set oDoc = oApplication.ActiveDocument > > > > > > ' Obtain the PropertySets collection object > > > Dim oPropsets As PropertySets > > > Set oPropsets = oDoc.PropertySets > > > > > > > > > ' Get a reference to the "Date Checked" property. > > > Dim oProp As Property > > > Dim PartNum As String > > > > > > Set oProp = > > > > > Show quoteHide quote > > NumberDesignTrackingProperties) > > > > > > ' Define a Date variable with the desired date. > > > > > > PartNum = "9836-scoobie1" > > > > > > ' Assign the date to the property. > > > oProp.Value = PartNum > > > > > > End Sub > > > > > > Thanks in advance, > > > Tony > > > > Tony,
fwiw there are 6 or 7 inventor groups on the adesk server. Chris is trying to get you to realize that's where you will have better luck They all start with autodesk.inventor hth Mark Show quoteHide quote "Veign" <NOSPAMinveign@veign.com> wrote in message news:%23k8mb43wFHA.2728@TK2MSFTNGP14.phx.gbl... > Just because you are writing code in VB(A) doesn't mean the code is native > VB(A) code. The applications that host VBA create their own libraries and > expose methods, properties, and events that are specific to the host > application. This is why you should be asking in a newsgroup geared towards > the host application and not VB(A)... > > If you don't want to take my advice, that's fine. Keep waiting here for an > answer.... > (4th time I have responded to one of your API questions) > > -- > Chris Hanscom - Microsoft MVP (VB) > Veign's Resource Center > http://www.veign.com/vrc_main.asp > Veign's Blog > Guys,
I think I got the codes. I am storing the data that is from the active file. How do I call a non-active file that is in the background (already opened) and it make it active.? Thanks, Tony You really don't like to listen do you....
Too bad.... -- Show quoteHide quoteChris Hanscom - Microsoft MVP (VB) Veign's Resource Center http://www.veign.com/vrc_main.asp Veign's Blog http://www.veign.com/blog -- <trac***@gmail.com> wrote in message news:1127849332.328803.246170@g47g2000cwa.googlegroups.com... > Guys, > > I think I got the codes. I am storing the data that is from the active > file. How do I call a non-active file that is in the background > (already opened) and it make it active.? > > > Thanks, > Tony > |
|||||||||||||||||||||||