Creates a block definition and adds an entity to the specified location

Source: Internet
Author: User

This is accomplished by creating a new block definition in the current drawing and adding an entity to the block definition, inserting the entity into the current sheet, as in the following example:

CString blockname = _t ("ADF");//this defines the name of the block to be createdAcdbblocktable *Pblktab; Acdbhostapplicationservices ()-workingdatabase ()-getblocktable (Pblktab, zcdb::kforwrite); if(Pblktab->has (Blockname))//determine if the block definition already exists{AfxMessageBox (_t ("The block definition already exists! A new block definition has been created with the name:") + Blockname +M_santennasys); Blockname+=M_santennasys; } Acdbblocktablerecord*PBLKTABRCD; PBLKTABRCD=NewAcdbblocktablerecord (); PBLKTABRCD-SetName (blockname);    Acdbobjectid Blockid; Pblktab-Add (Blockid, PBLKTABRCD); Pblktab-Close (); //selection of insertion pointAcgepoint3d Ptinsert; GetPoint (Ptinsert, _t ("Enter the ADF insertion point. ")); //add an entity to the block definitionAcdbblockreference *pblkref =NewAcdbblockreference (Pinsert, Idjiantou);//The previous parameter is the insertion point, and the latter is the entity IDPblkref->setrotation (DAngle);//Set Deflection angleCblockutil::setscalefactor (Pblkref, Dscale); PBLKTABRCD-appendzcdbentity (PBLKREF); Pblkref-Close (); //Insert the block into the current sheetAcdbblockreference *pblktabref =NewAcdbblockreference (Ptinsert, Blockid);//blockid the ID defined for the blockCdwgdatabaseutil::P osttomodelspace (PBLKTABREF);//This function is a generic function that inserts entities into the current model space and does not givePblktabrcd->Close (); Pblktabref->close ();

The above is done by creating a new block definition, adding entities, inserting the basic operation of the block definition, and depending on the specific requirements.

Creates a block definition and adds an entity to the specified location

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.