readblck.sml

  Download

More scripts: C A D

Syntax Highlighing:

comments, key words, predefined symbols, class members & methods, functions & classes
            
# readblck.sml
# demonstrate how to read the number of blocks in a CAD object
# and then loop through all the blocks and print out type of each element
clear();
cad C;
GetInputCAD(C);
numeric numBlocks = CADNumBlocks(C);
print("number of blocks: ", numBlocks);
# loop through all blocks
numeric blk, elem;
for blk = 1 to numBlocks {
	numeric numElements = CADNumElements(C, blk);
	printf("block: %3d number of elements: %5d \n\n", blk, numElements);
	# loop through all elements
	for elem = 1 to numElements {
		# get the element type
		string elem$ = CADElementType(C, blk, elem);
		printf("block: %3d element: %5d type: %s\n", blk, elem, elem$);
		}
	}
	
CloseCAD(C);