Civil 3D 2017 localization in VBA program ported to version 2018

Source: Internet
Author: User

China localization Pack is a piece of chicken,

But for some friends it is not true;

Unfortunately, the exit of China's localization package has lagged behind,

More than 1 years after the latest version of the software came out,

Localization is not sure to come out,

Even if it comes out,

It can only be obtained by users who have purchased a fast Bo service.

In the 2017 release of the localization pack,

Contains some 2009 versions of the VBA source code,

Although not all,

Does not contain all the features of the localization pack,

But for a friend who wants to learn how to use VBA for two of civil-dimensional development,

As a sample file, it's a good choice.

Let's take alignsectiondataporttool.dvb as an example,

Show me how to get this code to run in version 2018.

1. Download and install the VBA editor,

After version 2014, the VBA editor is not released with the Civil 3d main program.

Need to be downloaded and installed separately.

Click manage → application →visual Basic editor,

A dialog box pops up,

And there is a corresponding download link.

The following interface is installed:

2. Load the VBA project

If you have installed civil 3d 2017 and localized packages,

You can find the. dvb file in the following location:

C:\ProgramData\Autodesk\C3D 2017\chs\data\countrification VBA

If civil 3D 2017 and localization packs are not installed,

You can unzip the 2017 version of the Localization pack MSI file separately,

Copy the appropriate. dvb file from there to the appropriate location.

You can use the menu "load project" to load,

You can also drag and drop the. dvb file directly into the Civil 3D program window.

Then open the VBA editor for editing.

3. Modify the Code

1) Modify the object version

In the application module,

Modify the following:

' Const sappname = ' aeccxuiland.aeccapplication.6.0 '//Before modification

Const sappname = "aeccxuiland.aeccapplication.12.0"//Modified

How to query the object version,

In my book, AutoCAD civil 3D. NET two development "is a simple introduction,

2) Add Ptrsafe

' Private Declare Function getwindowsdirectory Lib ' kernel32 ' Alias ' Getwindowsdirectorya ' (ByVal lpbuffer as String, ByVal NSize as Long) as long//pre-modification

Private Declare ptrsafe Function getwindowsdirectory Lib "kernel32" Alias "Getwindowsdirectorya" (ByVal lpbuffer as String , ByVal NSize as Long) as long modified

There are many changes in the code that need to be

If you run the program directly,

A pop-up dialog box prompts you to

The code color is red,

Relatively easy to find,

Don't dwell on it.

3) Add Reference

Menu: Tools → references

Browse to:

Toggle file type to "All Files"

Select the appropriate. tlb file.

4) Modify the CFileDialog class module

' hWndOwner as Long//before modification

' HInstance as Long

hWndOwner as LONGPTR//modified

HInstance as LongPtr

' Lcustdata as Long

' Lpfnhook as Long

Lcustdata as LongPtr

Lpfnhook as LongPtr

Modify the above four variable types from long to longptr,

Otherwise, the Open File dialog box cannot be displayed.

5) Modify the configuration file path and create the configuration file

Open the setting module to modify the following:

Public Function Getconfigfilename () as String

' M_sfilename = windowsdisk & ' \documents and Settings\All Users\Application Data\autodesk\c3d 2018\chs\Data\ Countrification Vba\alignsectionconfig.dat "

M_sfilename = Windowsdisk & "\programdata\autodesk\c3d 2017\chs\data\countrification VBA\AlignSectionConfig.dat"

End Function

The path here is the path to the civil 3D 2017 localization package,

and create a text file in the appropriate location,

The name is AlignSectionConfig.dat,

The contents of the file are empty,

If this file does not exist,

Program run may pop up an error dialog box;

After the program is running correctly,

The settings information is saved in this file.

4 Run the Export command

Create surfaces, alignments, sample lines,

Note that the route is to belong to a certain site,

Cannot be a non-venue route.

The following dialog box appears:

Select the cross section data file:

Click Export

Contents of the exported file:

Postscript:

This moves the VBA program from a lower version to a higher version,

Enables individual features in the localization pack to be used in the latest version of Civil 3D,

But not all features can be upgraded,

Individual programs use other library files,

Without these files, the code cannot run.

If you want to make the capabilities of civil 3D more compatible with your needs,

Suggest that you do it yourself,

Learn two development of civil 3D.

Civil 3D 2017 localization in VBA program ported to version 2018

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.