Getting Part Documents From Assembly Documents in SolidWorks API - c#

Here is my scenario: I am reading in an Assembly file into Solidworks. From there, when the user is trying to edit a part, I want to get the information on which part file they want to edit.
Is there a way to get all the PartDoc information upon importing an AssemblyDoc file?
The closest I got to was getting the Body2 objects from the AssemblyDoc using
GetComponents() and GetBodies2() function described here. I had hoped that I could somehow grab the PartDocs from the bodies but I've found no way out.
Thank you in advance!

GetComponents return an array of IComponent2s.
For each component you can call GetModelDoc2 method to retrieve corresponding ModelDoc which can be either PartDoc, or AssemblyDoc.

Related

How to get Sprint field data in C# from MS Project mpp file via MPXJ?

I'm working on a project where I have to extract data from mpp files, that are Sprint Project files. I'm using MPXJ, and now stuck as I cannot seem to find a way to retrieve data from the 'Sprint' and 'Boad Status' fields.
I have tried the Task.getFieldByAlias() method unsuccessfully and when I list the ProjectFile.getCustomFields() result, the problematic fields are not included there either.
I have also looked it up in the MPXJ documentation and I discovered that there is a TaskField enum type that has these elements and that TaskContainer.getPopulatedFields() returns with Set<TaskField> however when I list it in my code, 'Sprint' and 'Board Status' aren't in there either, even though in the mpp file they are not empty.
Does anyone know a way to extract data from those fields peferably via MPXJ? I'm even open to new ideas regarding the parser at this point.

C# Revit API - How to pull info from autocad File

I've been working on this for the past month and am trying to get the final connection.
so far, I can open Revit, execute an Autocad DLL from a Revit button however I don't know how to pull the information back into the Revit API. I have tried a couple of different methods however I've come to a wall. Here are the options I've tried with explanations below
1) Combine the DLL file and the Revit Button API file into one using classes.
---> Trying this method leaves me with an error when loading an existing CAD file. I don't get this error if I'm creating a new CAD file or if I'm running the DLL by itself with Autocad set to Debug.
Grabbing CAD file failed.
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
e.StackTrace:
at AcDbDatabase.{ctor}(AcDbDatabase* , Boolean , Boolean )
at Autodesk.AutoCAD.DatabaseServices.Database..ctor(Boolean buildDefaultDrawing, Boolean noDocument)
at CAD2Revit.AutoCadOperations.grabCAD(String filepath)
at CAD2Revit.Command.Execute(ExternalCommandData commandData, String& message, ElementSet elements)
when trying to run this line:
// Create a database and try to load the file
Autodesk.AutoCAD.DatabaseServices.Database db = new Database(false, true); // error occuring here often
I've done some research on the error and this is the only close repoo
2) Keep them separate
--> In this option, I've figured out how programatticly open AutoCAD, netload a DLL, and then execute it which grabs the file information but then I cant return the info to the Revit API
Any wisdom or advice is appreciated on how to approach this.
this is the closest post i've seen similar to this but its in VB i think and is over my head.
https://forums.autodesk.com/t5/net/system-accessviolationexception-attempted-to-read-or-write/td-p/4796397
I see no reason why such a problem should appear. If all else fails, you could always use IPC to separate the two processes. However, there should not really be any need for this.

how to get as400 spool files to text in c#

I'm trying to code a console application to get the spool file from as400 to a different destination as a text file. I have been looking around but I haven't found a small code to start from there, I been searching around and haven't found anything close.
You guys have any idea or suggestion on how to start this?
I have the same problem. I'm using the API calls QUSRTVUS to get the spooledfile list and want to open a specific spooled file with information of the previous API call.
After getting the file list I create a new userspace with QUSCRTUS. Then I want to open the file with QSPOPNSP but that is my problem.
Sourcecode to open a file
After opening the file I would read the content with QSPGETSP which copies the file in the userspace where I could read it.
That's the plan but without opening the file the rest doesn't work.
I get the error directly when calling the API, this is not an error message during the work of the call. Changing the parameters don't change the error message.
Maybe someone has a hint?
UPDATE: I found out the mistake. Despite the misleading error message, it was an authorization problem. I wasn't allowed to call the APIs.

The item "obj\Debug\DateSelector.resources" was specified more than once in the "Resources" parameter.

I convert my huge website into web application. My application already have DateSelector.cs code file name, which is being used extensively in Project. Now Please tell me a way around that how can i stop on compilation the obj folder to not create DateSelector.resources file.
Have you tried doing a solution-wide search for "DateSelector.Resources" ? See if it turns up in one of the 'meta' files, it might just be listed twice.

Can intellisense be exported or extracted from Visual Studio to a text file?

I'm trying to write some documentation for a webservice that has been provided by one of our vendors for an application we're integrating. A bunch of the interface is custom objects defined in the web service itself. The vendor has put up significant resistance to providing any documentation for this application and so I've taken it upon myself to do their job for them [against my better judgement].
The documentation they have provided frankly is embarassing and I'm trying to make as short work of this as I possibly can to put some good quality docs together. I know that as I don't have access to their source, I can't just run it through nDoc/Sandcastle to spit out an API doc, but I was wondering if (as a half way house) there was an easy way to export the intellisense to a text file without me having to write a utility to specificially iterate through each of the object types defined and reflect the members out to text?
If I could do this, it would at least make sure that I have a good quality document structure where I can just fill in the blanks. Having to skip back and forth to Visual Studio to check the intellisense for every class member is a very laborious way of doing this.
Does anyone have any ideas?
If it is a web service that you are trying to document, couldnt you then parse out the WSDL?
If you are accessing a remote Web Service, then I think you have access to the corresponding WSDL: what about parsing it and look for just the information you need?
Or using a tool to do this (I Googled for "wsdl documentation generator")?
Or even using WSDL.exe to generate some dummy code from the WSDL and then document it, perhaps helped by GhostDoc?
HTH
Could you use Reflection to dump out the methods etc.?
Reflection is the feature in .Net, which enables us to get some information about object in runtime. That information contains data of the class. Also it can get the names of the methods that are inside the class and constructors of that object.
I think VS.net generates documentation for intellisense. For existing assemblies, it is already on your file system (e.g. C:\Windows\Microsoft.NET\Framework\v2.0.50727\en)
Try using the assembly from the vendor in VS.NET. Use process explorer or any such tool from sysinternals to see what files are being loaded. I am sure, you will find that there is an xml file created for the custom assembly (which is used to show the Intellisense and documentation available with it).
Hope that helps.
EDIT: I think the same folder (where your custom assemblies are located) will have the xml files for documentation.
If you have the dll's could you not decompile them and then recompile and use nDoc? That should give you a reasonalbe start.
Could you just use reflector (from redgate) to view the assembly (decompiled) instead of reproducing a API document. I'm not sure what else you would get of reflecting and building your on document that you wouldn't see live in reflector (of course this would depend on their writing readable code.
Maybe this is crazy, but could you take a screenshot of the full listing, and run it through an OCR program?

Categories

Resources