void CTwAutoRedraw::Remove() { long Len = 0; ads_sslength( m_ss, &Len ); for ( int i = 0; i < Len; i++ ) { ads_name ent; ads_ssname( m_ss, i, ent ); ads_redraw( ent, 4 ); } ads_ssfree( m_ss ); ads_name_clear( m_ss ); }
//assign the xrecord to the object //the xrecord stores the value for the properties //for now it looks like this: //double,double,long // void assignData() { if (!PropertyAdmin::isInitialized()) { acutPrintf("\nThe dynamic properties failed to intialize. Command is disabled."); return; } ads_name ss; if (acedSSGet(NULL,NULL,NULL,NULL,ss)!=RTNORM) return; long len=0; acedSSLength(ss,&len); ads_name ent; AcDbObjectId id; for (long i=0;i<len;i++){ if (acedSSName(ss,i,ent)==RTNORM) if (acdbGetObjectId(id,ent)==Acad::eOk) XRecordManager::createDefaultData(id); } ads_ssfree(ss); }
void hilitPoly() { Adesk::Boolean interrupted = Adesk::kFalse; ads_printf("\nSelect a poly"); AsdkPoly *poly = NULL; AcDbEntity *ent = NULL; AcDbObjectId polyId; ads_name ename, sset; for (;;) { switch (ads_ssget(NULL, NULL, NULL, NULL, sset)) { case RTNORM: // Get the poly from the selection set and do some subentity // highlighting testing. // // This code assumes that the user selected only one item. { struct resbuf *rb; if (ads_ssnamex(&rb, sset, 0) != RTNORM) { ads_ssfree(sset); return; } int sel_method; ads_name subname; short marker; AcGePoint3d pickpnt; AcGeVector3d pickvec; if (!extractEntityInfo(rb, sel_method, ename, subname, marker, pickpnt, pickvec)) { ads_ssfree(sset); return; } AOK(acdbGetObjectId(polyId, ename)); AOK(acdbOpenAcDbEntity(ent, polyId, AcDb::kForRead)); assert(ent != NULL); poly = AsdkPoly::cast(ent); if (poly == NULL) { ads_printf("\nNot a polygon."); AOK(ent->close()); ads_ssfree(sset); continue; } // Get the subentity and highlight it. int numPaths; AcDbFullSubentPath* subentPaths; AcGeMatrix3d xform; poly->getSubentPathsAtGsMarker( AcDb::kEdgeSubentType, marker, pickpnt, xform, numPaths, subentPaths); if(numPaths == 1) { // Highlight and unhighlight the subentity. // ads_printf("\nHighlighting the subentity"); poly->highlight(subentPaths[0]); pressEnterToContinue(); poly->unhighlight(subentPaths[0]); } else { // No path, user selected a section without a marker, // the text label for example // ads_printf("\nNo subentity to highlight"); } // Highlight and unhighlight the whole entity. // ads_printf("\nHighlighting the whole entity"); poly->highlight(); pressEnterToContinue(); poly->unhighlight(); delete []subentPaths; ads_ssfree(sset); } break; case RTNONE: case RTCAN: return; default: continue; } ads_ssfree(sset); break; } AOK(ent->close()); return; }
void hilitInsert() { Adesk::Boolean interrupted = Adesk::kFalse; ads_printf("\nSelect an insert"); Acad::ErrorStatus es = Acad::eOk; AcDbEntity *ent = NULL; AcDbEntity *ent2 = NULL; AcDbBlockReference *blRef = NULL; AcDbObjectId objectId, blRefId; ads_name ename, sset; for (;;) { switch (ads_ssget(NULL, NULL, NULL, NULL, sset)) { case RTNORM: { struct resbuf *rb; if (ads_ssnamex(&rb, sset, 0) != RTNORM) { ads_printf("\nads_ssnamex failed"); ads_ssfree(sset); return; } int sel_method; ads_name subname; short marker; AcGePoint3d pickpnt; AcGeVector3d pickvec; if (!extractEntityInfo(rb, sel_method, ename, subname, marker, pickpnt, pickvec)) { ads_printf("\nextractEntityInfo failed"); ads_ssfree(sset); return; } ads_ssfree(sset); assert(marker != 0); if (marker == 0) { ads_printf("\nmarker == 0"); return; } // Get the insert first. // AOK(acdbGetObjectId(blRefId, ename)); AOK(acdbOpenAcDbEntity(ent, blRefId, AcDb::kForRead)); assert(ent != NULL); blRef = AcDbBlockReference::cast(ent); if (blRef == NULL) { ads_printf("\nNot an insert."); AOK(ent->close()); continue; } struct resbuf *insStack; ads_point pickpoint; ads_matrix adsmat; pickpoint[0] = pickpnt[0]; pickpoint[1] = pickpnt[1]; pickpoint[2] = pickpnt[2]; // Now get details on the entity that was // selected. // if (ads_nentselp(NULL, ename, pickpoint, TRUE, adsmat, &insStack) != RTNORM) { ads_printf("\nFailure in ads_nentselp"); return; } assert(insStack != NULL); AOK(acdbGetObjectId(objectId, ename)); AOK(acdbOpenAcDbEntity(ent2, objectId, AcDb::kForRead)); assert(ent2 != NULL); // Make an array of AcDbObjectIds from the // insertStack. Don't use the "smart array" // AcDbObjectIdArray class, because the // getSubentPathsAtGsMarker() function expects argument // eight to be of type AcDbObjectId*. Just // make room for approximately 100 IDs in the array. // AcDbObjectId *idArray = new AcDbObjectId[100]; int count = 0; struct resbuf *rbIter = insStack; AcDbObjectId objId; acdbGetObjectId(objId, ename); idArray[count++] = objId; while (rbIter != NULL) { ename[0] = rbIter->resval.rlname[0]; ename[1] = rbIter->resval.rlname[1]; acdbGetObjectId(objId, ename); idArray[count++] = objId; rbIter = rbIter->rbnext; } count--; ads_relrb(insStack); // First, we'll highlight an edge. // int numPaths; AcDbFullSubentPath *subentPaths; AcGeMatrix3d xform; es = blRef->getSubentPathsAtGsMarker( AcDb::kEdgeSubentType, marker, pickpnt, xform, numPaths, subentPaths, count, idArray); assert(numPaths == 1); // Highlight and unhighlight the selected edge. // ads_printf("\nHighlighting the first edge."); es = blRef->highlight(subentPaths[0]); pressEnterToContinue(); es = blRef->unhighlight(subentPaths[0]); // If this is a solid, it will have faces. // In this case, let's highlight them. // if(ent2->isKindOf(AcDb3dSolid::desc())) { es = blRef->getSubentPathsAtGsMarker( AcDb::kFaceSubentType, marker, pickpnt, xform, numPaths, subentPaths, count, idArray); assert(numPaths == 2); // Highlight and unhighlight the selected // faces. // ads_printf("\nHighlighting the first" " face."); es = blRef->highlight(subentPaths[0]); pressEnterToContinue(); es = blRef->unhighlight(subentPaths[0]); ads_printf("\nHighlighting the next face."); es = blRef->highlight(subentPaths[1]); pressEnterToContinue(); es = blRef->unhighlight(subentPaths[1]); } delete []subentPaths; // Now, let's highlight the whole entity. // ads_printf("\nHighlighting the entire entity"); AcDbFullSubentPath subPath; for (int i = count; i >= 0; i--) { subPath.objectIds().append(idArray[i]); } es = blRef->highlight(subPath); pressEnterToContinue(); es = blRef->unhighlight(subPath); // Finally, let's highlight each enclosing // insert. // for (i = count -1; i >= 0; i --) { subPath.objectIds().removeAt( subPath.objectIds().length() - 1); ads_printf("\nHighlighting insert layer %d", i + 1); blRef->highlight(subPath); pressEnterToContinue(); es = blRef->unhighlight(subPath); } } // case RTNORM break; case RTNONE: case RTCAN: return; default: continue; } // switch break; } //for (;;) AOK(ent->close()); AOK(ent2->close()); return; }
void hilitSolid() { Adesk::Boolean interrupted = Adesk::kFalse; ads_printf("\nSelect a solid"); Acad::ErrorStatus es = Acad::eOk; AcDb3dSolid *solid = NULL; AcDbEntity *ent = NULL; AcDbObjectId solidId; ads_name ename, sset; for (;;) { switch (ads_ssget(NULL, NULL, NULL, NULL, sset)) { case RTNORM: { struct resbuf *rb; if (ads_ssnamex(&rb, sset, 0) != RTNORM) { ads_ssfree(sset); return; } int sel_method; ads_name subname; short marker; AcGePoint3d pickpnt; AcGeVector3d pickvec; if (!extractEntityInfo(rb, sel_method, ename, subname, marker, pickpnt, pickvec)) { ads_ssfree(sset); return; } AOK(acdbGetObjectId(solidId, ename)); AOK(acdbOpenAcDbEntity(ent, solidId, AcDb::kForRead)); assert(ent != NULL); solid = AcDb3dSolid::cast(ent); if (solid == NULL) { ads_printf("\nNot a solid."); AOK(ent->close()); ads_ssfree(sset); continue; } int numPaths; AcDbFullSubentPath* subentPaths; AcGeMatrix3d xform; es = solid->getSubentPathsAtGsMarker( AcDb::kEdgeSubentType, marker, pickpnt, xform, numPaths, subentPaths); // For objects with no edges (such as a sphere) the code to // highlight an edge is meaningless and must be skipped. // if (numPaths > 0) { // Highlight and unhighlight the selected edge of the solid. // ads_printf("\nHighlighting the selected edge."); es = solid->highlight(subentPaths[0]); pressEnterToContinue(); es = solid->unhighlight(subentPaths[0]); } else ads_printf("\nNo edges to highlight."); delete []subentPaths; // Highlight and unhighlight the faces corresponding to the // first edge of the solid. // es = solid->getSubentPathsAtGsMarker( AcDb::kFaceSubentType, marker, pickpnt, xform, numPaths, subentPaths); for (int i = 0; i < numPaths; i++) { ads_printf("\nHighlighting face %d of %d", i + 1, numPaths); es = solid->highlight(subentPaths[i]); pressEnterToContinue(); es = solid->unhighlight(subentPaths[i]); } delete []subentPaths; ads_ssfree(sset); // Highlight the entire solid, then unhighlight it. // ads_printf("\nHighlighting the entire solid"); es = solid->highlight(); pressEnterToContinue(); es = solid->unhighlight(); } break; case RTNONE: case RTCAN: return; default: continue; } ads_ssfree(sset); break; } AOK(ent->close()); return; }