CADViewer Technical Documentation, Installation Guide and Reference Samples Library

Search and Highlight of Block Attributes

When a block is created as a JSON object, its attributes can be retried from the Space Object JSON Structure. The Space Object JSON structure contains two variables specific for block handling:

  • blockAttributeId

  • blockAttributeIdCount

The algorithm to access Block Attributes and their corresponding values are found by looping over number of attributes, and extract their tag/value pairs.



myobject = cvjs_returnSpaceObjectID(rmid);


try {
	// get block attribute:
	// block attributes are listed with  ID_counter , and can be retrived with cvjs:tag and cvjs:value
	
	for (var i = 1; i <= myobject.blockAttributeCount; i++) {

		var attribId = "#" + myobject.blockAttributeId + "_" + i;
		
        //  this is just sample code to illustrate!!!!!!
        var attribute_tag = $(attribId).attr('cvjs:tag');
        var attribute_value = $(attribId).attr('cvjs:value');

	}
}
catch(err){

}

The following use-case:

Suppress/Exchange Highlight Modals

shows how to do a modal replacement and lists all block attributes in a given block.

Last updated on 29 Aug 2022
Published on 8 Aug 2022