Obtenir les dimensions générales

Veuillez poser ici vos questions, vos commentaires, concernant l'utilisation ou les problèmes rencontrés avec QCAD professionnel

Moderators: andrew, J-J

Forum rules

Indiquez toujours votre système d'exploitation et votre version de QCAD.

Joignez les fichiers de dessin et les captures d'écran.

Postez une question par sujet.

Post Reply
letux
Registered Member
Posts: 2
Joined: Mon Oct 13, 2008 8:34 am

Obtenir les dimensions générales

Post by letux » Mon Oct 13, 2008 9:10 am

Bonjour,

Je développe une application avec la librairie open source qcadlib pour une application de gestion de production. J'arrive à faire ce dont j'ai besoin mais j'aurais encore besoin d'obtenir les dimensions générales (hauteur, largeur) des pièces en millimètre. Comment puis-je faire cela. Toutes les autres dimensions ne m'intéresses pas, uniquement les deux principales.

Merci pour l'aide.

In english:

I am developping an application with the open source library qcadlib. I can do what I need but I need to obtain the main dimensions (width, height). How is it possible to do that? The others dimension is not needed.

Thank you for you help

letux
Registered Member
Posts: 2
Joined: Mon Oct 13, 2008 8:34 am

Post by letux » Wed Oct 15, 2008 2:28 pm

pour ceux que ça intéresse, j'ai fait cela comme cela:

Code: Select all

RS_LayerList *layerList = graphic->getLayerList ();
		for(int i=0; i < graphic->countLayers(); i++)
		{
			if( graphic->countLayerEntities ( layerList->at(i) ) > 0)
			{
				double minX = graphic->entityAt(0)->getMin().x;
				double minY = graphic->entityAt(0)->getMin().y;
				double maxX = graphic->entityAt(0)->getMax().x;
				double maxY = graphic->entityAt(0)->getMax().y;
				
				
				for(int j=0; j< graphic->countLayerEntities ( layerList->at(i) ); j++)
				{
					RS_Entity *entity = graphic->entityAt(j);
					
					if(entity)
					{
						RS_Vector min = entity->getMin();
						RS_Vector max = entity->getMax();
						
						if(min.x < minX) minX = min.x;
						if(min.y < minY) minY = min.y;
						if(max.x > maxX) maxX = max.x;
						if(max.y > maxY) maxY = max.y;
					}
				}
				
				qDebug() << (maxX - minX) << " x " << (maxY - minY);
			}
		} 
graphic est un RS_Graphic

Post Reply

Return to “QCAD Professional”