AutoCAD Customization: Autodesk ObjectARX
AcDbPolyline displayed incorrectly when using setLineTypeScale
Hello.
I have a linetype, which consists of two parallel straight lines. This linetype is loaded through shp and lin files. Some lines of a drawing of type AcDbPolyline use this linetype. There is also a regenerating procedure, which rescales linetype, for the screen distance between two straights of the linetype to be 1 mm, after any change of view scale. This procedure uses setLineTypeScale. Parameter for this method is calculated depending on the view scale.
When the drawing is generated first, lines that use that linetype look correctly. When I change the view scale, using the mouse wheel, screen width between the starights of the linetype changes accordingly, but this is ok. When then the drawing is rgenerated by my procedure, the linetype is rescaled, and the screen width between the linetype straight gets 1 mm again, and that is intended and ok. Until now everything is fine. When the drawing is scaled by its borders, the linetype scaling coefficient is about 400.
Then I add a raster image (jpg) on the drawing. At the end of this, lines of this linetype lose there screen wdth, and look incorrectly. The linetype scaling coefficient at this time remains the same, 400. On regenerating, the procedure repeats setting 400. The view scale remain the same. But the line size is lost. To get the screen width of the line 1 mm again, I have to put linetype scale about 2. Width of the line was 0 and is not changed.
So I came to a conclusion that screen size of a line depends not only on linetype scale. There might be some other parameter. What is that parameter, and how to get it using ObjectARX? I should have rescaled the linetype with 2 and not 400, but I don't know what has changed to take it into account.
Or there might be some other way to use two-starights linetype, with 1 mm distance on the screen for any view scale?
AutoCAD is 2010.3
Thanks in advance.
View scale is calculated this way:
double GetViewScale() { resbuf viewsize; acedGetVar(L"viewsize",&viewsize); resbuf screensize; acedGetVar(L"screensize",&screensize); double height = viewsize.resval.rreal; double screenheight = screensize.resval.rpoint[Y]; return height/screenheight; }
The linetype is constructed this way:
// in .shp file *216,15,RRS 1,3,50,020,2,028,4,35,02C,3,35,028,1,070,0 // in .lin file A,0.00000001,[RRS,mylin.shx,S=1.6],0.22,0.00000001
How to Create the FrameWnd derived from the CFrameWnd class
Hi ! Everyone!
If some one knows, Please help me.
I'm beening develop ARX program on the AutoCAD 2013 64 bit environment, Using the VS2010.
But, I encounterd big problems to create the Framewnd.
Below code worked AutoCAD2010 and VS2008 environment.
//---------------------------------------------------------------------------
CAcModuleResourceOverride resOverride;
dataFactory.pFrame = new CMainFrame;
RECT CRect = {x, y, 0, 0};
if (!dataFactory.pFrame->Create(_T("Test Wnd!"),
WS_VISIBLE | WS_OVERLAPPEDWINDOW, CRect, NULL))
acutPrintf(_T("Error: Failed to create the Window!"));
dataFactory.pFrame->MoveWindow (x, y, 300, 195);
dataFactory.pFrame->m_flg = TRUE;
acedGetAcadFrame()->SetFocus();
//----------------------------------------------------------------------------
The dataFactory class where restored some pointers and variables
Aboved code did not work on the 2013 and VS2010.
dataFactory.pFrame->MoveWindow (x, y, 300, 195); is crashed.
The Wnd pointer must be exist, It is not NULL.
Where am I wrong??
Please help me!!!!
AutoCAD API Wishlist Survey 2013
It is my pleasure to announce the launch of the AutoCAD API wishlist survey for 2013. I hope you’ll be willing to give 5-10 minutes of your time to take the survey – the results will be used to guide the efforts of our engineering team.
The survey will remain open until 21st of June 2013
How can I make a startUp Exe for Startup AutoCAD
I have dev a set of arxs programs,Now I want to develop a startUp.exe which can startUp AutoCAD and Let it search for acad.rx file in the folder where the startUp.exe located.
the Arxs that acad.rx file contains is also in the same folder.
More details or code will be prefer.
Standalone ObjectARX application hosted in windows service, is it possible?
Hi,
We are trying to write a windows service and manipulate DWG files there. In our computer we have already AutoCAD installed.
It seems with ObjectARX , it is just possible to write .Net dlls which will be hosted in AutoCAD application not any standalnoe application.Did we get it right?
we know about RealDWG but the problem is that we also need ability to plot(save) manipulated files, which is not possible with RealDWG.
Is there any other solution for writing a standalone application can manipulate and plot( pdf) DWG files?
Is there any solution with AUTODESK product for our problem?
Thanks .
How Can I realise the screen-menu in the picture?
All in title,And I use ARX2002.The More details ,the better.~thanks!
Adding a material to a document from an adsklib
Hello,
Is there an ObjectARX way to import/add materials from a material library (adsklib) to a drawing ?
Thnx,
Zolee
Contextual tab selector rules - available triggers?
HI,
I'm looking for a list of all available triggers for Contextual Tab Selector rules (describing here). In the file AcContextualTabSelectorRules.xaml I noticed that only two triggers are used:
- Selection
- SystemVariable
Is there trigger for command? In this case, what is the right syntax to use?
Regards,
Jonathan
why the setAngles function show the imprecision angles
I use the function setAngles to make a semicircle ,but the semicircle'angle is not 180 degree,it is mybe 179 degree. i was mixed-up,why????? my plaform is VS2005(C++)+arx2008,
code:
double PI = 3.14159265358979323846;
AcGeCircArc3d *cirArc = new AcGeCircArc3d();
cirArc->setAngles(0.0, PI);
AcGeIntArray edgeTypes;
AcGeVoidPointerArray edgePtrs;
edgeTypes.append(AcDbHatch::kCirArc);
edgePtrs.append((void*)cirArc);
Hatch1->appendLoop(AcDbHatch::kDefault, edgePtrs, edgeTypes);
es=Hatch1->evaluateHatch();
what is the problem???
A book on ARX, would it still have a market?
I've become a registered Autodesk developer (again) to write a book on programming Inventor. But I notice that the ARX group is still active. Would a new version of my ARX book and course still have a market as well?
See here: ARX book (end of page) for the old book and old course
The function acedTraceBoundary want to know about.
Hi
I want to use acedTraceBoundary, an example is needed.
Example, the need a minute there that can help?
VB.Net 2013 eLockViolation
VB.Net 2013 eLockViolation
So I seem to be having some issues with using VB.net. I looked at the helloWorld sample, as well as the makeEnts sample and I can't seem to resolve the fack that I get a eLockViolation error that pops up and mentioned JIT issues. So what I was trying to do is simple run a routine to load a forum which allows the user to select which new layers to create. That being said the code I use to create the layers within the forum fails every time. If I move the code to create the layers into the main file shopSetup.vb instead of shopSetupForm.vb then it work. I know that it isn't a problem with the code specfically but maybe that the form doesn't have access to the currently open document or something? I am not sure really and I am just kind of guessing. Please let me know thank you.
*********************************************************** shopSetup.vb *********************************************************** Option Explicit On Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports DBTransMan = Autodesk.AutoCAD.DatabaseServices.TransactionManager Namespace shopSetup Public Class shopSetup <Autodesk.AutoCAD.Runtime.CommandMethod("Setup")> _ Public Sub setupCommand() Dim userForm As New shopSetupForm() Application.ShowModelessDialog(userForm) End Sub End Class End Namespace *********************************************************** shopSetup.vb *********************************************************** Option Explicit On Imports Autodesk.AutoCAD.Runtime Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports DBTransMan = Autodesk.AutoCAD.DatabaseServices.TransactionManager Public Class shopSetupForm Private Sub okButton_Click(sender As System.Object, e As System.EventArgs) Handles okButton.Click Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database Dim tm As DBTransMan = db.TransactionManager Dim ta As Transaction = tm.StartTransaction() Try Dim LT As LayerTable = tm.GetObject(db.LayerTableId, OpenMode.ForRead, False) If LT.Has("ASDK_MYLAYER") = False Then Dim LTRec As New LayerTableRecord() LTRec.Name = "ASDK_MYLAYER" LT.UpgradeOpen() LT.Add(LTRec) tm.AddNewlyCreatedDBObject(LTRec, True) ta.Commit() End If Finally ta.Dispose() End Try 'Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database 'Dim tm As DBTransMan = db.TransactionManager 'Dim ta As Transaction = tm.StartTransaction() 'If slabCheckBox.Checked = True Then ' Dim LT As LayerTable = tm.GetObject(db.LayerTableId, OpenMode.ForRead, False) ' Dim layers As New List(Of String) From {"SLAB-EDGE", "SLAB-GRID", "SLAB-MISC", "SLAB-DEFPOITNS"} ' Try ' For Each layerName In layers ' If LT.Has(layerName) = False Then ' Dim LTRec As New LayerTableRecord ' LTRec.Name = layerName ' LT.UpgradeOpen() ' LT.Add(LTRec) ' tm.AddNewlyCreatedDBObject(LTRec, True) ' ta.Commit() ' End If ' Next ' Finally ' ta.Dispose() ' End Try 'End If 'Me.Close() End Sub Private Sub quitButton_Click(sender As System.Object, e As System.EventArgs) Handles quitButton.Click, quitButton.Click Me.Close() End Sub End Class
I have inclued both the code for simple review and also the entire vb directory for further review. Thank you in advance for your help. This is my first .net application so I am still learning a bit, I do like the .net format more then the C++ format due to the decrease in complexity of the pointers, as well as all the issues I was having with setting up a project etc.
Load Ribbon in AutoCAD-2011 using C++/CLI
Hello Experts,
My code is like:
Autodesk::Windows::RibbonControl ^ribbonControl = Autodesk::Windows::ComponentManager::Ribbon;
//gets the Ribbon Control but does not get Ribbon from ComponentManager
Autodesk::Windows::RibbonTab ^Tab = gcnew Autodesk::Windows::RibbonTab();;
Tab->Title = "My Custom Ribbon Tab";
Tab->Id = "RibbonSample_TAB_ID";
ribbonControl->Tabs->Add(Tab); //does not sets the value of "(ribbonControl)->Tabs"
Anyone knows where is Issue in my code??
Thanks-
Best practice for Targeting Multiple ObjectARX platforms for solution?
Hi Everyone...
I have a fairly large solution for a managed library commandset in ACAD. I have my solutions configured for targeting either 32-bit or 64-bit platforms by having different solutions for each.
What is the best way to target different Object ARX (2012, 2014, 2013, etc) without continuing to make a static set of projects for each platform? I thought that I could use the Build Targets perhaps but didn't want to get too far down a path if it was just silly. I was going to try and do conditional references as detailed here...
http://stackoverflow.com/questions/1997268/how-to-reference-different-version-of-dll-with-msbuild
What do you all do for targeting multiple architectures and ObjectARX versions?
thanks
JA
Unable to register symbol
HI ,
I am unable to register the developer symbol at http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=1075006 .
Clicking on the link , takes me to http://www.autodesk.com/symbreg/startreg.htm , which says "Page Not found"
Please help
Thanks
Sujay
can anyone give me a copy of realdwg sdk?
I want to do some reaserch about realdwg, but it seems that it is not as easy to download as objectarx.
Dose Autodesk have something like DwgDirect?
Dlls with objectarx cannot be runned without AutoCAD, I want to do someresearch with some sdk like ojbectarx , but I would not like to do this on AutoCAD for some reason.
I know that there is some opensource sdk like dwgdirect, do autodesk privode some sdk which I can use ?
How to retrieve a view thumbnail (AcDbViewTableRecord::getThumbnail)?
Hi,
I'm trying to retrieve the preview of a view using the function AcDbViewTableRecord::getThumbnail. I get a BITMAPINFO object and I'm trying to create a HBITMAP from it :
BITMAPINFO * pBitmapInfo = NULL; if((es = pRecord->getThumbnail(pBitmapInfo)) == Acad::eOk) { void * pBuffer = NULL; HBITMAP hBitmap; if((hBitmap = CreateDIBSection(NULL, pBitmapInfo, DIB_RGB_COLORS, &pBuffer, NULL, 0)) != NULL) { ... } delete pBitmapInfo; }
The problem is that the result is an image of 128x85 pixels all black.Maybe it's more a problem using Windows methods? Does anybody have an example?
Best regards,
Jonathan
Dialog in Static Library
I have a dialog box consisting of 8 progress bars which is used by multiple projects. I define it in a project which creates a static library file called EMD_Common.lib which is on my library path. The files that define the class are "Progress.cpp" and "Progress.h". In my projects that use it, I #include "Progress.h", declare a global variable CProgress *dlg, and create (try to create) the dialog with the following:
CAcModuleResourceOverride resOverride;
dlg = new CProgress(acedGetAcadFrame());
dlg->Create(IDD_DIALOG_PROGRESS);
The ARX modules compile fine (no errors or warnings), but when I get to the code above when running the routines, I get an error about an unsupported operation. The IDD_DIALOG_PROGRESS is defined in the resource.h file in the library project.
Any suggestions would be appreciated.
Thanks,
Ed
