Jump to content

Search the Community

Showing results for tags 'vb.net'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions

Categories

  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Found 18 results

  1. So I have a VBA sub that assigns a variable to a drawing directly by its name. Trying to do the same thing in VB.NET however, it goes to an error like "Conversion from string to type Integer is not valid". Here is the code in vb.net, I have a opened autocad file named "Drawing3.dwg") and the error comes up in the last row. Dim acad As AcadApplication Dim drwg As AcadDocument acad = GetObject(, "AutoCAD.Application") drwg = acad.Documents("Drawing3.dwg") If I use this instead, it goes trough with no issues: drwg = acad.Documents(0) Now, in VBA you could either put an integer or a string with the name of the drawing in the parenthesis and it would work, in VB.NET only works with integer it looks like. I was wondering if there is another way around it without having to loop through all opened drawings and have it check the names. Thanks a lot!
  2. Hi everyone, I'm relatively new to VB and AutoCAD, and I've been trying to incorporate a command line method into my existing code to copy, move, and scale a drawing. However, I've hit a roadblock and would appreciate some guidance. Every time I try to run the code, I encounter an error stating "acdbmgd.dll not found." From what I understand, this seems to be related to a missing reference or dependency associated with AutoCAD libraries. Here's the code I've been working on: Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.EditorInput Public Class SelectionSetClass <CommandMethod("SelectWindowAndCopy")> Public Sub SelectWindowAndCopy() Dim doc As Document = Application.DocumentManager.MdiActiveDocument Dim db As Database = doc.Database Dim edt As Editor = doc.Editor Using trans As Transaction = doc.TransactionManager.StartTransaction() Dim psr As PromptSelectionResult = edt.SelectWindow(New Point3d(36, 22, 0), New Point3d(149.5, 33, 0)) If psr.Status = PromptStatus.OK Then Dim ss As SelectionSet = psr.Value ' Get the bottom-left corner of the window selection Dim windowBottomLeft As Point3d = New Point3d(35, 22, 0) For Each sobj As SelectedObject In ss Dim ent As Entity = TryCast(trans.GetObject(sobj.ObjectId, OpenMode.ForWrite), Entity) If Not ent Is Nothing Then '' Create a copy of the selected entity Dim entCopy As Entity = ent.Clone() ' Create a copy of the entity '' Calculate the translation vector to move the bottom-left corner of the entity to the origin Dim translationVector As Vector3d = New Vector3d(-windowBottomLeft.X, -windowBottomLeft.Y, 0) '' Apply the translation transformation entCopy.TransformBy(Matrix3d.Displacement(translationVector)) '' Apply the scaling transformation Dim scaleMatrix As Matrix3d = Matrix3d.Scaling(10, New Point3d(0, 0, 0)) entCopy.TransformBy(scaleMatrix) '' Open the Block table for write Dim acBlkTbl As BlockTable = trans.GetObject(db.BlockTableId, OpenMode.ForRead) Dim acBlkTblRec As BlockTableRecord = trans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) '' Add the copied entity to the block table record acBlkTblRec.AppendEntity(entCopy) trans.AddNewlyCreatedDBObject(entCopy, True) End If Next End If trans.Commit() End Using End Sub End Class I've tried researching this issue online, but I'm still unsure how to resolve it. Can anyone please provide insights on how I can properly reference the required AutoCAD libraries in my project settings to fix this error? Any help or suggestions would be greatly appreciated. Thank you in advance!
  3. Hello to everybody, I'm writing my first message as I started developing my first App. The thing is I have a dwg with the same number of paper space layouts and views, and the same viewport for all the paper space's layouts. So the problem is: I'm stuck trying to link the viewport of each layout to the correspondig view. I attach in .txt the code for VB.NET and appreciate if anybody can help me in this very first real project. Thanks for helping.CODES.txt
  4. I would like to have a MainWindow open as modeless so it can stay open, but calling the command again results in multiple modeless windows. How can I check if the MainWindow is already open to prevent multiples? <CommandMethod("BatchProcess")> Public Sub cmdBatchProcess() Dim winBatPro As New MainWindow Application.ShowModelessWindow(winBatPro) End Sub
  5. i can use VB.net to edit normal inserted block reference's attribute textstring but it's not working for dynamic block, pls help. Best regard.
  6. I need to change the attribute of "tag" = "PRO" in all blocks of the model space of the active document in autocad. The text you need to add is "my project". I searched for information about walking blocks and change the attributes but I get nothing. Can anyone help me please?
  7. Hello, Our users must be able to rotate a bunch of lines, circles, blocks etc (which result in looking like a conveyor). I am trying to pass a SelectionSet using the built-in rotate command of AutoCAD. I got a lot of help on the AutoDesk forums: http://forums.autodesk.com/t5/net/how-to-pass-objectidcollection-into-built-in-rotate-command/m-p/5429159#M42620 I seem to be in a stalemate right now. I don't have AutoCAD 2015 so I use a RunCommand wrapper to enable me to use the editor.Command(). Imports System.Collections.Generic Imports System.Linq Imports System.Text Imports System.Linq.Expressions Imports System.Reflection Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.EditorInput Module EditorInputExtensionMethods <System.Runtime.CompilerServices.Extension()> _ Public Function Command(editor As Editor, ParamArray args As Object()) As PromptStatus If editor Is Nothing Then Throw New ArgumentNullException("editor") End If Return runCommand(editor, args) End Function Dim runCommand As Func(Of Editor, Object(), PromptStatus) = GenerateRunCommand() Private Function GenerateRunCommand() As Func(Of Editor, Object(), PromptStatus) Dim method As MethodInfo = GetType(Editor).GetMethod("RunCommand", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.[Public]) Dim instance As ParameterExpression = Expression.Parameter(GetType(Editor), "editor") Dim args As ParameterExpression = Expression.Parameter(GetType(Object()), "args") Return Expression.Lambda(Of Func(Of Editor, Object(), PromptStatus))(Expression.Call(instance, method, args), instance, args).Compile() End Function End Module I then populate my SelectionSet using an object ID collection that was built. Here is my code that I use to try and use the already built-in rotate command that AutoCAD has to offer: <CommandMethod("My-Rotate")> _ Public Sub MyRotate() 'Get the current document and database Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument Dim acCurDb As Database = acDoc.Database Dim acObj As Object Dim entRes As PromptEntityResult Dim entOpts As PromptEntityOptions Dim rb As ResultBuffer Dim FoundHunter As Boolean Dim acBlkTbl As BlockTable Dim acBlkTblRec As BlockTableRecord Dim pickedPolyline As Polyline = Nothing Dim SelSet As SelectionSet Dim Lst_ObjId As New List(Of ObjectId) 'Prompt user to select the conveyor he wants to rotate Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView() entOpts = New PromptEntityOptions(vbLf & "Choose the object you wish to rotate") entRes = acDoc.Editor.GetEntity(entOpts) If (entRes.Status = PromptStatus.OK) Then 'Start a transaction Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction() acObj = entRes.ObjectId.GetObject(OpenMode.ForRead) 'Make sure the selected object was a polyline If Not TypeOf acObj Is Polyline Then MsgBox("You must choose a line or polyline") : Exit Sub rb = New ResultBuffer rb = entRes.ObjectId.GetObject(OpenMode.ForRead).XData() 'Sets the correct Project Conveyor ProjectConveyor.SetByDataTable(GetPKFromResultBuffer(rb), Project.PK_Project) 'Open the Block table for read acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId, OpenMode.ForRead) 'Open the Block table record Model space for write acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite) 'Go through the Block Table Record and build the collection ID For Each acObjId As ObjectId In acBlkTblRec rb = New ResultBuffer rb = acObjId.GetObject(OpenMode.ForRead).XData() FoundHunter = False If Not rb Is Nothing Then For Each tv As TypedValue In rb If tv.TypeCode = DxfCode.ExtendedDataRegAppName Then If tv.Value = "MY_PROGRAM_NAME" Then FoundHunter = True End If If FoundHunter And tv.TypeCode = DxfCode.ExtendedDataInteger32 Then If tv.Value = ProjectConveyor.PK_ProjectConveyor Then Lst_ObjId.Add(acObjId) 'Sets up all object IDs correctly here Exit For End If End If Next rb.Dispose() End If Next 'Create a selection set from object IDs SelSet = SelectionSet.FromObjectIds(Lst_ObjId.ToArray) 'Use AUTOCAD's Rotate function knowing we have all selections in selection set acDoc.Editor.Command("_.rotate", SelSet, "") 'Save the new objects to the database ProjectConveyor.Update() acTrans.Commit() End Using End If End Sub My issue is, whenever I get to the acDoc.Editor.Command() portion, it does not prompt the user to rotate anything. It returns Error(-5001) ... Any ideas?
  8. Hi Autocad Experts, I am new to Autocad customization using VB.net. We have a requirement to draw a horizontal line from a given co-ordinate to the point where it intersects with any other line. It's perhaps already discussed in the forum, but since I am new to vb.net, I am not able to put things together. Appreciate any help I can get from this forum. Looking forward to replies.
  9. hi everbody i am new to autocad .net customisation. i want to know that how can we use user interface for user inputs and what is the alternative for DCL in autolisp. for example i have a program(dll) in vb.net. it creates one array how can take one value from the user. i want to use combobox and then populate it from the array. then take the input from the user and againg do some code. is it possible? if yes how can i do it. please guide me. thank in advance gvg
  10. I'm writing a program to import a WMF into the AutoCad Drawing. I haven't been able to find any reference for the import command, so I can't figure out why it's not working. According to Visual Studio, the Import command needs these things to work. Import(String FileName, Object InsertionPoint, Double ScaleFactor) Simplified Code: Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.Geometry Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.AutoCAD.Interop Dim AcadApp As Autodesk.AutoCAD.Interop.AcadApplication AcadApp = CType(GetObject(, "AutoCAD.Application.18.2"), Autodesk.AutoCAD.Interop.AcadApplication) acadDoc = AcadApp.ActiveDocument acadDoc.Import("C:\Users\C\Documents\Drawing1.wmf", New Point3d(2, 2, 0), 2.0) When I comment out the last line of code, acadDoc.Import("C:\Users\C\Documents\Drawing1.wmf", New Point3d(2, 2, 0), 2.0) It runs fine. The error I'm getting is when I run it AutoCAD, ************** Exception Text ************** System.ArgumentException: Value does not fall within the expected range. at System.StubHelpers.ObjectMarshaler.ConvertToNative(Object objSrc, IntPtr pDstVariant) at Autodesk.AutoCAD.Interop.IAcadDocument.Import(String FileName, Object InsertionPoint, Double ScaleFactor) at TestSelectingFiltering.TestSelecting.MyCommands.FilterBlueCircleOnLayer0() at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction) at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke() Any help would be greatly appreciated, Thanks!
  11. Hello, My goal is to set up a batch printing on all AutoCAD drawings. Each drawing will have a record similar to this: The PartNo records underlined in red are other drawings that my recursive function will go through. That's why I must access this information. I believe I must access an object named "BLOCKNT" in order to do so but I'm unsure about the syntax. FYI, for some reason, whenever I try to use this code: ApplicationServices.Application.DocumentManager.MdiActiveDocument I get the following error: This is a .exe application and I have read that I cannot use NETLOAD commands in a .exe project? Does this make sense? Thank you! Alex
  12. NirantarVidyarthee

    No 'SelectionSets' in VB.net

    From the AutoDESK help docs (http://docs.autodesk.com/ACD/2013/ENU/index.html?url=files/GUID-D0BD4249-1122-4209-ABEA-6F19FA156F91.htm,topicNumber=d30e719293) "AutoCAD.Application.ActiveDocument.SelectionSets.Add method Not needed/provided" in VB.Net Thus 'Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SelectionSets' will not work. So, I can't store multiple selection sets in VB.Net? Why is it not provided? Or is there some other way to do that?
  13. NirantarVidyarthee

    Convert Drawing To pdf

    Is it possible to export a drawing to pdf without opening a drawing where AutoCAD is installed. I want to write my own code using AutoLISP or VB.Net (and not use any existing third party utility) because I have some specific additional requirements. Any guideline would be helpful. Is ObjectDBx the way to go?
  14. Good Day All Busy looking for a method to be able to have an image displayed as a pop cursor in AutoCAD. Most of the applications do this with the drag and drop function. Want to be able to do this with the mouse click events. Not sure if this is possible? as in AutoCAD the drawing area displays the cross hairs. Main objective is that i have a symbol libruary from a tree control - already have the image in a Byte() format. Want to draw the image onto a pop control as the mouse cursor. Just a good asthetic display when picking the insertion points of the object. Any advice or assistance much appreciated. Regards CaveMan
  15. Hi all, The are dwg files created by a third design company using AutoCad I have installed DWG TRUEVIEWER 2012 by autodesk only for viewing. Is it possible to use vb.net to lunch – open a dwg file apart of pointing directly to exe ? Thanks
  16. Good Day looking for code in vb.net where i can retrieve what exrefs are in a drawing file without opening it. Will also like to be able to edit the exrefs paths and files within the drawing database. The method would also be useful to extract attributes etc. from drawing files without opening them. Any help most welcome. Regards CaveMan
  17. Hi all, Trying to convert the popular VB VPlayerOff function to VB.Net with added functionality of turning a layer off in all viewports in a layout. My code seems to do everything right except update the Xdata with the new results. I tried manipulating the Xdata result buffer initially but is said it was read only so that is why I have done it this way. I will post the Xdata functions from "From Jerry Winters AU 2009 Class - "Store it in the DWG: XData, Extension Dictionaries and Object Data Through .NET" in a separate post since I went over my allotted 15000 charaters. Note, Current code needs an object on a layer called 'test' in drawing file, with something in the layer . Thanks Mike PS - first time posting so hope I did this right! [size=3][font=Times New Roman][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Interop[/font][/font][/size] [font=Times New Roman][size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Interop.Common[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Runtime[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.DatabaseServices[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.EditorInput[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Geometry[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.ApplicationServices[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.ApplicationServices.[color=#2b91af]Application[/color][/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.LayerManager[/font][/size] [size=3][color=blue][font=Consolas]Imports[/font][/color][font=Consolas] Autodesk.AutoCAD.Windows[/font][/size] [size=3][color=blue][font=Consolas]Public[/font][/color][font=Consolas] [color=blue]Class[/color] [color=#2b91af]vbTools[/color][/font][/size] [size=3][font=Consolas]<[color=#2b91af]CommandMethod[/color]([color=#a31515]"VPLOFF"[/color])> _[/font][/size] [size=3][color=blue][font=Consolas]Public[/font][/color][font=Consolas] [color=blue]Sub[/color] VPLOFF()[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myDB [color=blue]As[/color] [color=#2b91af]Database[/color] = [color=#2b91af]HostApplicationServices[/color].WorkingDatabase[/font][/size] [size=3][color=blue][font=Consolas]Using[/font][/color][font=Consolas] myTrans [color=blue]As[/color] [color=#2b91af]Transaction[/color] = myDB.TransactionManager.StartTransaction[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myBT [color=blue]As[/color] [color=#2b91af]BlockTable[/color] = myDB.BlockTableId.GetObject([color=#2b91af]OpenMode[/color].ForWrite)[/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] [color=blue]Each[/color] myBtrID [color=blue]As[/color] [color=#2b91af]ObjectId[/color] [color=blue]In[/color] myBT[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myBTR [color=blue]As[/color] [color=#2b91af]BlockTableRecord[/color] = myBtrID.GetObject([color=#2b91af]OpenMode[/color].ForWrite)[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myBTR.IsLayout = [color=blue]True[/color] [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myLayout [color=blue]As[/color] [color=#2b91af]Layout[/color] = myBTR.LayoutId.GetObject([color=#2b91af]OpenMode[/color].ForWrite)[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myLayoutString [color=blue]As[/color] [color=blue]String[/color] = myLayout.LayoutName[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myVPIDs [color=blue]As[/color] [color=#2b91af]ObjectIdCollection[/color] = myLayout.GetViewports()[/font][/size] [size=3][color=blue][font=Consolas] For[/font][/color][font=Consolas] [color=blue]Each[/color] myVPortID [color=blue]As[/color] [color=#2b91af]ObjectId[/color] [color=blue]In[/color] myVPIDs[/font][/size] [size=3][color=blue][font=Consolas] Dim[/font][/color][font=Consolas] myVP [color=blue]As[/color] [color=#2b91af]Viewport[/color] = [color=blue]DirectCast[/color](myTrans.GetObject(myVPortID, [color=#2b91af]OpenMode[/color].ForWrite), [color=#2b91af]Viewport[/color])[/font][/size] [size=3][font=Consolas] DocumentManager.MdiActiveDocument.Editor.WriteMessage(myVP.Layer + vbNewLine)[/font][/size] [size=3][font=Consolas] VpLayerOff([color=#a31515]"test"[/color], myVPortID)[/font][/size] [size=3][font=Consolas] myVP.UpdateDisplay()[/font][/size] [size=3][color=blue][font=Consolas] Next[/font][/color][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]Using[/color][/font][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]Sub[/color][/font][/size] [size=3][color=blue][font=Consolas]Sub[/font][/color][font=Consolas] VpLayerOff([color=blue]ByVal[/color] myVpLyrName [color=blue]As[/color] [color=blue]String[/color], [color=blue]ByRef[/color] myVPID [color=blue]As[/color] [color=#2b91af]ObjectId[/color])[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] I [color=blue]As[/color] [color=blue]Integer[/color][/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] Counter [color=blue]As[/color] [color=blue]Integer[/color][/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myResBuff [color=blue]As[/color] [color=#2b91af]ResultBuffer[/color] = GetXData(myVPID, [color=#a31515]"ACAD"[/color])[/font][/size] [size=3][color=blue][font=Consolas]Dim[/font][/color][font=Consolas] myNewResBuff [color=blue]As[/color] [color=blue]New[/color] [color=#2b91af]ResultBuffer[/color][/font][/size] [size=3][color=blue][font=Consolas]If[/font][/color][font=Consolas] myResBuff [color=blue]Is[/color] [color=blue]Nothing[/color] = [color=blue]False[/color] [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myResBuff.AsArray) [color=blue]To[/color] UBound(myResBuff.AsArray)[/font][/size] [size=3][color=green][font=Consolas] 'debug print out Xdata[/font][/color][/size] [size=3][font=Consolas] DocumentManager.MdiActiveDocument.Editor.WriteMessage(myResBuff.AsArray(I).TypeCode & vbTab & myResBuff.AsArray(I).Value.ToString & vbNewLine)[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myResBuff.AsArray(I).TypeCode = 1003 [color=blue]Then[/color][/font][/size] [size=3][font=Consolas] Counter = I + 1[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myResBuff.AsArray(I).Value.ToString = myVpLyrName [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas] Exit Sub[/font][/color][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=blue][font=Consolas]Else[/font][/color][/size] [size=3][font=Consolas]MsgBox([color=#a31515]"NO XData under that AppName."[/color])[/font][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]If[/font][/color][font=Consolas] Counter = 0 [color=blue]Then[/color][/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myResBuff.AsArray) [color=blue]To[/color] UBound(myResBuff.AsArray)[/font][/size] [size=3][color=blue][font=Consolas] If[/font][/color][font=Consolas] myResBuff.AsArray(I).TypeCode = 1002 [color=blue]Then[/color][/font][/size] [size=3][font=Consolas] Counter = I - 1[/font][/size] [size=3][color=blue][font=Consolas] End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]If[/color][/font][/size] [size=3][color=green][font=Consolas]'adds existing data to the new result buffer we are creating[/font][/color][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myResBuff.AsArray) [color=blue]To[/color] Counter - 1[/font][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](myResBuff.AsArray(I).TypeCode, myResBuff.AsArray(I).Value))[/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][color=green][font=Consolas]'appends the new frozen layer and closes the set[/font][/color][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](1003, myVpLyrName))[/font][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](1002, [color=#a31515]"}"[/color]))[/font][/size] [size=3][font=Consolas]myNewResBuff.Add([color=blue]New[/color] [color=#2b91af]TypedValue[/color](1002, [color=#a31515]"}"[/color]))[/font][/size] [size=3][color=green][font=Consolas]'debug display to see new record buffer[/font][/color][/size] [size=3][font=Consolas]DocumentManager.MdiActiveDocument.Editor.WriteMessage(vbNewLine & vbNewLine)[/font][/size] [size=3][color=blue][font=Consolas]For[/font][/color][font=Consolas] I = LBound(myNewResBuff.AsArray) [color=blue]To[/color] UBound(myNewResBuff.AsArray)[/font][/size] [size=3][color=green][font=Consolas]'debug print out Xdata[/font][/color][/size] [size=3][font=Consolas]DocumentManager.MdiActiveDocument.Editor.WriteMessage(myNewResBuff.AsArray(I).TypeCode & vbTab & myNewResBuff.AsArray(I).Value.ToString & vbNewLine)[/font][/size] [size=3][color=blue][font=Consolas]Next[/font][/color][/size] [size=3][font=Consolas]AddXData(myVPID, myNewResBuff)[/font][/size] [size=3][color=blue][font=Consolas]End[/font][/color][font=Consolas] [color=blue]Sub[/color][/font][/size] [size=3][color=blue][font=Consolas]End Class[/font][/color][/size] [/font]
  18. Hi all, I am writing a VB.net program wherein several parts would be created through a data read from a file and saved to a project location. I am unable to figure out a way to set the reference of a selected .ipj file to a inventor project inside my VB program. Help would be appreciated. Best regards Milind Location: Pune, INDIA
×
×
  • Create New...