Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I want load percentage. #85

Open
kwangheum opened this issue Oct 21, 2022 · 0 comments
Open

I want load percentage. #85

kwangheum opened this issue Oct 21, 2022 · 0 comments

Comments

@kwangheum
Copy link

kwangheum commented Oct 21, 2022

ThreeDxf.Viewer

`for(i = 0; i < data.entities.length; i++) {
entity = data.entities[i];

        if(entity.type === 'DIMENSION') {
            if(entity.block) {
                var block = data.blocks[entity.block];
                if(!block) {
                    console.error('Missing referenced block "' + entity.block + '"');
                    continue;
                }
                for(var j = 0; j < block.entities.length; j++) {
                    obj = drawEntity(block.entities[j], data);
                }
            } else {
                console.log('WARNING: No block for DIMENSION entity');
            }
        } else {
            obj = drawEntity(entity, data);
        }

        if (obj) {
            var bbox = new THREE.Box3().setFromObject(obj);
            if (bbox.min.x && ((dims.min.x === false) || (dims.min.x > bbox.min.x))) dims.min.x = bbox.min.x;
            if (bbox.min.y && ((dims.min.y === false) || (dims.min.y > bbox.min.y))) dims.min.y = bbox.min.y;
            if (bbox.min.z && ((dims.min.z === false) || (dims.min.z > bbox.min.z))) dims.min.z = bbox.min.z;
            if (bbox.max.x && ((dims.max.x === false) || (dims.max.x < bbox.max.x))) dims.max.x = bbox.max.x;
            if (bbox.max.y && ((dims.max.y === false) || (dims.max.y < bbox.max.y))) dims.max.y = bbox.max.y;
            if (bbox.max.z && ((dims.max.z === false) || (dims.max.z < bbox.max.z))) dims.max.z = bbox.max.z;
            scene.add(obj);
            objects.push(obj);
        }
        obj = null;
        const percentage = parseInt(i/(data.entities.length-1)*100);
		console.log(`${percentage}%`)
		$("#loading-progress").html(`load <br>${percentage}%`);
    }`

print console.log but not draw html..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant