Preface : With the further development of industrialization , manufacturing 、 Industrial automation and other fields , May use the upper monitoring system . and WPF In the aspect of upper monitoring system , It should be regarded as one of the most popular front-end frameworks at present . With the continuous improvement and updating of the monitoring system , The monitoring screen will become more and more complex 、 Diversification and comprehensiveness .
With the increasingly complex and huge monitoring images , If you rely on developers to draw patterns 、 Model, etc , It will undoubtedly be a huge workload . And the development of most monitoring systems , It may also need to be combined CAD Layout of drawings “ Custom authoring ”, It is also a complicated project . If you can CAD Drawings are directly converted to WPF Canvas drawings for , Then the work of developers will become more relaxed and pleasant , Just make some simple adjustments to become your own set of monitoring system . So the following article , I will take a few very simple steps , Let's demonstrate how to pass CAD Convert drawing to XAML Code file method , For the big guys .
zero : In order to prevent being crawled to various unfriendly websites ( Will automatically synchronize to CSDN Same account number , except Blog Garden And CSDN Outside , Could have been crawled by a reptile , Beware of being fooled ), And prevent it from affecting our reading experience , It is suggested that you can click the original link of the blog in the blog park to read :
https://www.cnblogs.com/weskynet/p/16412223.html
One 、 To demonstrate a simple operation , Let me open a blank CAD, Later, it is used to draw point content .
Two 、 Customize and draw something casually , Three rectangles are included here , Three circles , An ellipse , And a spiral pattern , There is another line of text , Use as a test .
3、 ... and 、 After drawing ( Normal use , It could be opening cad After drawing , Go straight to this step ), choice file -> Save as , Save drawing as .dxf File format , For follow-up AI Tool to open .
Four 、 Use AI Tool to open .dxf file
【 remarks 】 When you open it here, because the boundary is set, it is all displayed as 1px, So the three circles became thinner , Please ignore this detail .
5、 ... and 、AI After the tool is opened , choice file - Export to .xaml Format . Under normal circumstances, it can be exported as silverlight and wpf Two kinds of , Here we choose to export as wpf Supported by xaml Format .
【 remarks 】AI The exported path cannot have Chinese , Otherwise, the export may not succeed .
6、 ... and 、 After the export is successful , In the export directory , You can see that a .xaml Format code file .
7、 ... and 、 Open it with a text file and have a look , You can see the familiar xaml Label code , It consists of <viewbox/> Control contains , So you can also directly use it to make user controls and so on , Big guys can play by themselves .
8、 ... and 、 Create a new one WPF project , There are currently no elements in the main form , For subsequent test generation xaml Code can be used .
Nine 、 Will export xaml Code file code , Copy all to the main form , You can see that the main form designer automatically displays the effect of elements . And CAD The drawings are basically the same .
Ten 、 Let's run the program , See the effect after startup , As shown in the figure below , The exported code can be used directly , And in line with expectations .
11、 ... and 、 about AI The tool did not export WPF Option , You need to add a plug-in . Plug in download address :http://mikeswanson.com/xamlexport/
Download address to open the next page , As shown in the figure below , I have already given you a very detailed method to use , Refer to the prompt information to place the plug-in .
Twelve 、 Download plug-ins , After decompression, there will be two aip file , One is MAC The system supports , The other is Windows The system supports , As shown in the figure below , Store in AI Under the installation directory of the tool plug-ins Under folder .
【 remarks 】AI If the installation is a cracked version 、 Or it is not the default installation path , It is possible to identify that the plug-in is not successful , For example, opening AI When it comes to programming , It might suggest "ai Failed to load multiplier " And so on. .
The above is the whole content of the article , Thank you for your support .
If the big guys are right .NET Interested in technology , You can find the original link of the blog Garden of this article :https://www.cnblogs.com/weskynet/p/16412223.html
At the bottom there is a join QQ Group information , You can directly join .
Or you can scan the following QR code , Add my personal wechat , Then discuss technology together , Or apply to join the wechat group , I will also bring you into the wechat group , It's also OK Of .
Finally, I wish the big guys a happy time ~~
If it helps , Welcome to thumb up 、 Collection or comment forwarding ~~ You are welcome ~~