Hello Mayi,
On Wed, 1 Jun 2005 08:29:40 +0000, Mayi wrote:
> But I am shamed to say that I know little about ActiveX and COM.
>
There is nothing to be a shamed for!
> Follow your instruction , I found there are three folders in
> docsamps\comsamps :
> AsdkMfcComSamp,AsdkPlainComSamp,AsdkSquareWrapper
>
> My ARX Project is based on MFC (VC 6.0),Which folder should I look into
> first?
>
The AsdkMfcComSamp is based on MFC so that will be a start.
> and also I want to know where can I get ActiveX class:AcadPlot
I knew that I formulated that part badly! (English isn't my first language)
AcadPlot is an ActiveX Class (Look in the VBA help in the AutoCAD\Help
directory) There are two ways to use ActiveX in VC++/MFC. One is to use the
ClassWizard and Add Class and select acad.tlb[1]. Now the ClassWizard will
create a class, or more correctly a number of classes, for you to use to
access AutoCAD via ActiveX/COM One of the classes may be named IAcadPlot
The other way, which 'most' people recommend, is to #import "acad.tlb". A
introductory article on how to use this can you find here:
http://www.codeproject.com/database/WittmerADO.asp
This is about ADO[2] but it will teach the basic things.
The classes you will need to use are:
IAcadApplicationPtr
IAcadDocumentPtr
IAcadPlotPtr
The AsdkMfcComSamp is using ClassWizard!
> and which funtions should I invoke from AcDbPlotSettingsValidator and
> AcApLayoutManager to realize requirement of printing?
>
That depends on what you want to do 😉
To get the current layout:
AcApLayoutManager *pLayoutManager = (AcApLayoutManager*)
acdbHostApplicationServices()->layoutManager();
const char *layoutName = pLayoutManager->findActiveLayout (true);
// get the current layout
AcDbLayout *pLayout = pLayoutManager->findLayoutNamed (layoutName, true);
To initialize AcDbPlotSettingsValidator you need to do this:
// get the plotsetttings class
AcDbPlotSettingsValidator *pPlotSettingsValidator =
acdbHostApplicationServices()->plotSettingsValidator();
// Refresh the layout lists in order to use it
pPlotSettingsValidator->refreshLists (pLayout);
// change the current layout plotter
es = pPlotSettingsValidator->setPlotCfgName (pLayout, szPrinterPath);
// set style table
es = pPlotSettingsValidator->setCurrentStyleSheet(pLayout,szStylePath);
// setup the plot type to window
es = pPlotSettingsValidator->setPlotType (pLayout,
AcDbPlotSettings::kExtents);
// set the scale
es = pPlotSettingsValidator->setStdScaleType (pLayout,
AcDbPlotSettings::StdScaleType::kScaleToFit);
// we have to close the layout here because the last parameter of
// findLayoutNamed is true, leave layout open
pLayout->close ();
> I am sorry that my question may bring you some trouble and waste your
> time,but hopefully,may you help me once again?
>
No problem! I hope that you can figure out something using the info I have
given you. If not ask again!!
If times permit I will create a sample application for plotting from
ObjectArx. (This will not happen before the weekend)
Best wishes
// Anders