A method of three-dimensional building model is quickly generated based on two-dintension CAD drawing
Technical field
The present invention relates to a kind of methods generating three-dimensional building model, fast based on two-dintension CAD drawing more particularly to one kind
Fast-growing belongs to computer graphics disposal technology field at the method for three-dimensional building model.
Background technology
When the fast development with science and technology, the fields such as public security, fire-fighting, military affairs are accurate to the personnel in complex space region
The increasingly apparent increase of demand of positioning, but accurate positioning will also rely on accurate three-dimensional building model.Three-dimensional building mould at present
The design method of type has very much, and common methods have following several:
Three-dimensional Design Software models
Professional designer completes the three-dimensional modeling of buildings model by Three-dimensional Design Software, by exporting certain format three
Dimension module is imported into again to be needed in three-dimensional scenic system to be used, and the advantages of this method is can to make buildings model ratio by rendering
It is more true to nature, manually model can also be changed again;Know the disadvantage is that this method needs the designer of profession to understand modeling
Know, and needs designer to consume plenty of time energy and design, it is higher to the professional skill requirement for modeling personnel.
It is imported based on two dimensional model
Designer passes through the stretching of Three-dimensional Design Software, rotation by the two-dimentional buildings model data of parsing certain format
Turn the structure for waiting operations to realize three-dimensional building model.The advantages of this method is can to generate the three-dimensional about the same with two-dimentional drawing
Model;But the disadvantages of this method is the entity that cannot be distinguished corresponding to data object, there are data redundancy and can not be directed to finger
Fixed object does scene reproduction, such as stair, fire hydrant, extra exit etc., so cannot be satisfied the demand of professional scenario building.
Invention content
In view of the above-mentioned defects in the prior art, three-dimensional is quickly generated based on two-dintension CAD drawing the present invention provides one kind to build
The method for building model solves prior art design or generates that three-dimensional building model difficulty is big, efficiency is low, model data redundancy etc.
Problem.
Technical solution of the present invention is as follows:A method of three-dimensional building model is quickly generated based on two-dintension CAD drawing, including
Following steps:S101, the architectural plan of single floor is imported into two-dimentional software;S102, the figure for obtaining current architectural plan
Layer information;S103, according to preset characteristic element, classify to figure layer;S104, corresponding diagram is extracted according to characteristic element
The model information of specific features element in layer;S105, the feature that the model information comprising characteristic element is exported with structured document
Factor data file;S106, the characteristic element data file output for judging whether to be completed all floors, if being completed into
Enter S201, S101 is returned if not completing;S201, the characteristic element data file for importing all floors;S202, pass through parsing
Characteristic element data file identifies the model information of each characteristic element;S203, it is generated respectively according to the model information of characteristic element
The model of characteristic element simultaneously obtains corresponding buildings model.
Preferably, the preset characteristic element includes wall, door and window, stair, extra exit and emphasis facility.
Preferably, the model information of the characteristic element includes the information of the point of characteristic element, line, multi-line section and block.
Further, the information of the point, line, multi-line section and block includes the coordinate of point, line, multi-line section and block.
Further, the step S106, when judging whether to be completed the characteristic element data file output of all floors
Judged according to floor quantity.
Preferably, the characteristic element data file includes building name, the high information of number of floor levels and building.
The advantages of technical solution provided by the present invention, is:Drawing is exported using the two-dimentional architectural drawing of each floor of building
In the model information of construction characteristics element such as corresponding wall, door and window, stair, extra exit and emphasis facility and build structuring text
Part recycles the model information that Three-dimensional Design Software automatically extracts construction characteristic element from structured document to quickly generate corresponding three
Buildings model is tieed up, this method can be applied to the fields such as public security, fire-fighting, military affairs, solve the three-dimensional of the types buildings such as emphasis, complexity
Model quickly, the problem of Mass production, provide support for personnel's precise positioning in complex space region.
Description of the drawings
Fig. 1 is the overview flow chart that two-dimentional software exports characteristic element data file.
Fig. 2 is floor architectural plan.
Fig. 3 is the general flow chart that Three-dimensional Design Software generates buildings model.
Fig. 4 is the three-dimensional building model schematic that embodiment generates.
Specific implementation mode
With reference to embodiment, the invention will be further described, but not as a limitation of the invention.
Shown in Fig. 1 to Fig. 4, three-dimensional building mould is quickly generated based on two-dintension CAD drawing involved by the present embodiment
The method of type is implemented in combination with two-dimentional drawing creation threedimensional model with AutoCAD2014 and Unity3D.AtuoCAD is building trade
In common design software, provide a variety of secondary development modes such as VisualLisp, VBA and ObjectARX, the present embodiment
Quickly generated based on two-dintension CAD drawing the method for three-dimensional building model for the processing of two-dimentional drawing be using VS2010 with
AutoCAD2014 combines exploitation, specific that C#.NET platforms is used to be developed.Fig. 1 shows output characteristic element data text
The overall procedure of part, specifically includes following steps:
S101, floor drawing is imported:Single floor architectural plan as shown in Figure 2 is loaded into AutoCAD softwares,
The acdbmgb.dll and acmgb.dll that the application of the present embodiment exploitation loads AutoCAD first are contained as reference document
.NET outsourcing class all in API passes through AtuoCAD custom menus and [CommandMethod (" XXX ")] character association
Recall main interface.
S102, extraction map data mining platform:Obtain the map data mining platform of current floor architectural plan.It is read by main interface current
The figure layer LayerTable information of floor architectural plan is shown with tabular form and can show hidden come direct feel by controlling
Characteristic element corresponding to figure layer.Characteristic element includes mainly wall Wall, door and window Window, stair Stair, extra exit
The preset Architectural elements such as Exit and emphasis facility Equipment.
S103, figure layer element category:Figure layer collection with same characteristic features element is combined into a classification, each classification corresponds to
One characteristic element.All will draw has the figure layer collection of wall Wall to be combined into one kind, and all draftings are had door and window Window's
Figure layer collection is combined into one kind, etc..
S104, extraction element information:According to characteristic element extract the point Point3d of specific features element in corresponding figure layer,
The model informations such as line Line, multi-line section Polyline and block BlockReference, such as drafting have the figure layer of wall Wall then
The model informations such as point, line, multi-line section and the block of wall Wall are extracted, drafting has the figure layer of door and window Window to be extracted door and window
Model informations such as point, line, multi-line section and the block of Window, etc..These points, line, multi-line section and block model information contain
The coordinate of point, line, multi-line section and block.
S105, output characteristic element data file:It is wanted by information binding characteristics such as building name, number of floor levels and building height
The model information of element exports characteristic element data file in the form of XML file.
S106, judge whether that the characteristic element data file that all floors are completed exports according to building floor quantity,
Terminate flow if being completed, returning to S101 if not completing imports other floor drawings.
The life of the three-dimensional building model of the method that three-dimensional building model is quickly generated based on two-dintension CAD drawing of the present embodiment
It, can be fast in conjunction with VS2010 at being the convenient script Compile interfaces of Unity3D by taking the preferable Unity3D of three-dimensional rendering effect as an example
Speed deployment development environment.Fig. 3 shows that Three-dimensional Design Software generates the general flow chart of buildings model, is as follows:
S201, the characteristic element data file for importing all floors;
S202, parsing characteristic element:The mould of each characteristic element is identified by analytic structure characteristic element data file
Type information, thus to obtain the corresponding point of each characteristic element, the coordinate of line, multi-line section and block.
S203, buildings model is generated:Using parsing characteristic element data file obtain the corresponding point of each characteristic element,
The coordinate of line, multi-line section and block, and generate corresponding buildings model according to corresponding characteristic element.In the worlds Unity3D
Object shapes are determined by Mesh elements, and Mesh is formed by coordinate point-rendering.Therefore by wall, this characteristic element is corresponding
Point, line, multi-line section and block coordinate be assigned to the corresponding Mesh of wall and can draw the Mesh elements of wall, and then generate wall Object
Shape, other all characteristic elements make same treatment, in conjunction with information such as building name, floor and building height to build
Go out entire three-dimensional building model.Finally by material setting Material so that three-dimensional building model is more life-like, final effect
As shown in Fig. 4.