Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all 7260 articles
Browse latest View live

RE: [V8i MicroStationAPI] Facetting Anomaly

$
0
0

[quote user="Jon Summers"]Why should this one be different?  Does the facetting throw out a rectangle occasionally, along with the triangles?[/quote]

My speculation is that the degenerate shape for the top profile is going to have more indices referencing the same underlying point coordinate, i.e. you have 4 vertices, but only 2 unique coordinates.

-B


RE: [V8i MicroStationAPI] Facetting Anomaly

$
0
0

[quote user="Brien Bastings"]My speculation is that the degenerate shape for the top profile [/quote]

Well, on closer examination of the point indices, it looks like the ElementGraphicsProcessor is giving me a bunch of triangles and finally two polygons having two vertices each.  I guess I can simply discard those  8-)

RE: [V8i MicroStationAPI] Facetting Anomaly

$
0
0

[quote user="Jon Summers"]and finally two polygons having two vertices each.  I guess I can simply discard those  8-)[/quote]

I would think there should still be 3 vertices, just 2 of the points will be the same...I'll try a picture...

RE: Helix method generates inconsistent B-Splines

$
0
0

That was easier than I thought, here you go. The problem does persist. I suspect it has to do with how the helix is approximated with the B-Spline. The difference between an actual helix and the results of the Helix method are very noticeable in my application. I use this for a spiral stairway, sweeping the helix for the stringers on either side of the treads, and when I place the treads in their correct locations they don't line up with the stringers.

Sub helices()
    Dim oElement1 As Element
    Dim oElement2 As Element
    Dim oBsplineCurve As New BsplineCurve
    Dim axis As Segment3d
    Dim startPt As Point3d
    Dim radius0 As Double
    
    startPt = Point3dFromXYZ(1, 0, 0)
    axis = Segment3dFromXYZXYZStartEnd(0, 0, 0, 0, 0, 1)
    oBsplineCurve.helix 1, 1, startPt, axis, 1, False
    Set oElement1 = CreateBsplineCurveElement1(Nothing, oBsplineCurve)
    oElement1.Color = 0
    ActiveModelReference.AddElement oElement1
    oElement1.Redraw
    
    axis = Segment3dFromXYZXYZStartEnd(0, 0, 0, 0, 0, 0.33333333333)
    oBsplineCurve.helix 1, 1, startPt, axis, 1, False
    Set oElement2 = CreateBsplineCurveElement1(Nothing, oBsplineCurve)
    oElement2.Color = 3
    ActiveModelReference.AddElement oElement2
    oElement2.Redraw
End Sub

RE: Helix method generates inconsistent B-Splines

$
0
0
Is there an optional tolerance you can specify when creating the helix curve?

RE: Helix method generates inconsistent B-Splines

$
0
0

There is, but the documentation states it only applies when the radii are different, and I can confirm that it seems to have no effect on my constant radius helix.

RE: VBA Code Question

$
0
0

Hi Bill,

at first I'd like to recommend two things:

  • Please use Syntax highlighter tool (yellow pencil) and set Syntax to VB whenever you post any code.
  • If it's possible, add also variable definitions to code snippet. In VBA is't usually easy to understand what type a particular variable is, but not always.

[quote user="Bill Hasted"]Te first line I assume is finding the desired Tag Set[/quote]

If eleTag.TagSetName = "RT_Title_A0_A1_A2" Then

No, it tests if existing TagElement is defined in the desired TagSet. To better understand this test, lets clarify how Tags work:

  • TagSet is a container, that holds Tags Definitions. They are not displayable objects.
  • If Tag is attached an element, TagElement is created in a design file and linked to the element and (optionally) displayed.
  • TagElement holds value of the tag, but does not contain any information about the definition. But it know TagSet name and TagDefitionName, so if necessary, the tag definition can be searched.

[quote user="Bill Hasted"]My concern is the Erase part of the expression as I don't wish to erase any existing data.[/quote]

eleTag.Redraw msdDrawingModeErase

It does not erase anything, it redraws TagElement using specific draw mode. I guess after this line of code, it hides the tag (redraw to be erased from screen) until next view refresh. Redraw operations are not persistent, they only redraw particular element on screen.

Because we don't know details (how old is the code, what it does, in what MicroStation version the macro is used) it's hard to say if it's obsolete construction or a result of some specific requirement.

In the past, MicroStation developers should take care about displaying elements, especially in dynamics (placement, modification). It requires to understand how elements are displayed, what does it mean to redraw element in XOR mode etc. From V8 XM Edition it's not necessary and in the most situations developers (especially in VBA that hides a lot MicroStation implementation and operational details) don't have to take care about update views (e.g. after element is added or removed from model) or can use simple calls (de.g. during dynamic).

So I have to admit I understand what this line does, but I don't understand why it's used.

[quote user="Bill Hasted"]Is there a reference for MicroStation related commands that I am yet to find?[/quote]

It depends what information you are looking for. A combination of MicroStation help file (to understand how MicroStation works) and MicroStation VBA help file (an explanation of MicroStation VBA API) provides enough information for typical VBA macros. Learning MicroStation VBA book from is very good source of information as well as articles on Jon Summers' web.

For advanced VBA macros sometimes also MDL API documentation is reuquired, because it contains VBA wrappers description for MDL functions.

With regards,

  Jan

RE: VBA Code Question

$
0
0

[quote user="Bill Hasted"]Trying to understand some existing code that is changing the value of Tag data[/quote]

This overview of tag data may help.

[quote user="Bill Hasted"]Is there a reference for MicroStation related commands that I am yet to find?[/quote]

VBA Help

Well, there's VBA help.


VBA Code Question

$
0
0

Trying to understand some existing code that is changing the value of Tag data. The extract below is the bit I am unsure about.

Te first line I assume is finding the desired Tag Set but what does the second line do?

My concern is the Erase part of the expression as I don't wish to erase any existing data.

As you will have guessed I am new to this and would appreciate any help.

Is there a reference for MicroStation related commands that I am yet to find?

If eleTag.TagSetName = "RT_Title_A0_A1_A2" Then
         eleTag.Redraw msdDrawingModeErase

Thanks

Bill

RE: CreateTextElement1 Issue

$
0
0
Oh, don't pay attention on that, are .dgn files with other extension. Excuse me!

RE: Helix method generates inconsistent B-Splines

$
0
0

[quote user="D C"]The problem does persist [in VBA][/quote]

I confirm that the VBA code reproduces the problem.  I have no answer for you.  Perhaps a B-spline expert at Bentley Systems can tell us more...

RE: [V8i C++] How to rename reference files via MDL/Api

$
0
0

[quote user="Artur Goldsweer"]

From the MDL description:

StatusInt      mdlRefFile_reattach
(
DgnModelRefP      modelRef ,
char*      outName ,
char const*      fileName ,
MSWChar const*      modelName
);

[/quote]

Unfortunately, it does not provide the same functionality as the VBA code example. I am interested in adding an environment variable to existing reference attachments to make it easier later when drawings are moved. Yes - I probably could just adjust MS_RFDIR, but I am interested in trying to use an environmental variable instead of MS_RFDIR. A current ref file shows "MyRefFile" for the File Name in the References dialog. I would like to change it to, for example, "REFHOME:MyRefFile" which doesn't seem possible via mdlRefFile_reattach(). When I pass "REFHOME:MyRefFile" as the fileName param, I get a SUCCESS return code, but the name still shows "MyRefFile" and shows in red (file not found).

RE: Helix method generates inconsistent B-Splines

$
0
0

[quote user="D C"]

There is, but the documentation states it only applies when the radii are different, and I can confirm that it seems to have no effect on my constant radius helix.

[/quote]
You are correct, I see that the constant radius case just calls mdlBspline_spiral and then adjusts the pole z coordinates. I don't think there's anything you can to with this method to get a different result. Can you try MicroStation's Helix Curve tool and see if that produces an acceptable result? 
-B

RE: Helix method generates inconsistent B-Splines

$
0
0

Brien,

I can't use manual methods as I am automating this from an external program.

I think, short of Bentley changing how the B-Spline is created, I will need to make an individual helix for each step in the stairway, chain them together with CreateComplexShapeElement1, and then sweep the stringer surface with SweepProfileAlongPath.

Any other ideas would be welcome.

Thanks

RE: Helix method generates inconsistent B-Splines

$
0
0

[quote user="D C"]I can't use manual methods as I am automating this from an external program[/quote]

I think that Brien's asking you to try the manual method to confirm that the results match what you see with VBA.


RE: Helix method generates inconsistent B-Splines

$
0
0

[quote user="D C"]I can't use manual methods as I am automating this from an external program.[/quote]

I know that, I was just curious if the result curve would be acceptable, as the tool uses a different approach to create the curve. But it doesn't look to me that what the tool is using is available from VBA anyway.

RE: [V8i C++] How to rename reference files via MDL/Api

$
0
0

[quote user="Bruce Reeves SRNS"]I am interested in trying to use an environmental variable instead of MS_RFDIR[/quote]

When MicroStation starts up it processes its configuration files.  If it finds a variable that is undefined, it attempts to resolve from the Windows environment table.

If REFHOME is defined as a Windows environment variable, then this will pick it up...

# REFHOME is a Windows environment variable
MS_RFDIR > $(REFHOME)

[quote user="Bruce Reeves SRNS"]When I pass "REFHOME:MyRefFile [to mdlRefFile_reattach()]" [/quote]

I don't know if that function has the same fall-back logic as the configuration file processor.  You can experiment like this...

# In your configuration file
MY_REFHOME = $(REFHOME)

Now use it in the function...

mdlRefFile_reattach(.., .., "MY_REFHOME:file-name", ...)

[V8i C++] How to rename reference files via MDL/Api

$
0
0

In VBA, I can use this to "rename" a reference file:

For Each AttachedFile In ActiveModelReference.Attachments
            NewAttachmentName = "NEWMAPS:" & AttachedFile.AttachName
            AttachedFile.SetAttachNameDeferred NewAttachmentName
            AttachedFile.Rewrite
Next

I have not been able to determine how to perform the same task using MDL and/or the MicroStation API. Is it possible?

Thanks,

Bruce

RE: Helix method generates inconsistent B-Splines

$
0
0

[quote user="Brien Bastings"]I was just curious if the result curve would be acceptable[/quote]

I tried it out and the manual tool does create the helix much more accurately, and the tolerance setting is functional. I created a set of points to show exactly where the helix should lay, I can get the helix almost exactly on them.

Looking at the element information I can see that the Helix method creates a curve with 13 control points while the manual tool creates one with 860.

If someone at Bentley could tell me how the built in tool works I could set the B-spline directly instead of through the Helix method.

RE: Helix method generates inconsistent B-Splines

$
0
0

VBA Macro Recorder

One approach is to record a VBA macro while executing the place helix command. Make sure you toggle/set all the UI buttons, hoping that the macro recorder will tell you what internal variables were twiddled.

Viewing all 7260 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>