Chem4Word / Version3-2

Version 2022 (3.2) of Chem4Word - A Chemistry Add-In for Microsoft Word
https://www.chem4word.co.uk
Other
21 stars 2 forks source link

The alignment of the render does not match the drawing in the editor #27

Closed tomyan112 closed 2 years ago

tomyan112 commented 2 years ago

image image

Edit: Added markdown to format cml nicely. CML Data

<cml:cml xmlns:conventions="http://www.xml-cml.org/convention/" xmlns:cml="http://www.xml-cml.org/schema" xmlns:cmlDict="http://www.xml-cml.org/dictionary/cml/" xmlns:nameDict="http://www.xml-cml.org/dictionary/cml/name/" xmlns:c4w="http://www.chem4word.com/cml" conventions="convention:molecular">
  <c4w:customXmlPartGuid>8e99280b3d5a4652acd6330132e516dc</c4w:customXmlPartGuid>
  <cml:molecule id="m1">
    <cml:formula id="m1.f0" concise="C 2 H 2 R 2" />
    <cml:formula id="m1.f1" convention="chem4word:ResolvedFormula" inline="Not requested" concise="C 2 H 2 R 2" />
    <cml:formula id="m1.f2" convention="chem4word:ResolvedSmiles" inline="Not requested" concise="C 2 H 2 R 2" />
    <cml:name id="m1.n1" dictRef="chem4word:CalculatedInchi">Unable to calculate</cml:name>
    <cml:name id="m1.n2" dictRef="chem4word:CalculatedInchikey">Unable to calculate</cml:name>
    <cml:name id="m1.n3" dictRef="chem4word:ResolvedIupacname">Not requested</cml:name>
    <cml:atomArray>
      <cml:atom id="a1" elementType="C" x2="539.7258" y2="607.5" />
      <cml:atom id="a2" elementType="R1" x2="513.7451" y2="622.5" />
      <cml:atom id="a3" elementType="R2" x2="565.7066" y2="622.5" />
      <cml:atom id="a4" elementType="C" x2="539.7258" y2="577.5" />
    </cml:atomArray>
    <cml:bondArray>
      <cml:bond id="b1" atomRefs2="a1 a2" order="S" />
      <cml:bond id="b2" atomRefs2="a1 a3" order="S" />
      <cml:bond id="b3" atomRefs2="a1 a4" order="D" />
    </cml:bondArray>
  </cml:molecule>
  <cml:molecule id="m2">
    <cml:formula id="m2.f0" concise="R 1" />
    <cml:formula id="m2.f1" convention="chem4word:ResolvedFormula" inline="Not requested" concise="R 1" />
    <cml:formula id="m2.f2" convention="chem4word:ResolvedSmiles" inline="Not requested" concise="R 1" />
    <cml:name id="m2.n1" dictRef="chem4word:CalculatedInchi">Unable to calculate</cml:name>
    <cml:name id="m2.n2" dictRef="chem4word:CalculatedInchikey">Unable to calculate</cml:name>
    <cml:name id="m2.n3" dictRef="chem4word:ResolvedIupacname">Not requested</cml:name>
    <cml:atomArray>
      <cml:atom id="a5" elementType="R2" x2="671.2549" y2="600.0" />
    </cml:atomArray>
  </cml:molecule>
  <cml:molecule id="m3">
    <cml:formula id="m3.f0" concise="Mg 1" />
    <cml:formula id="m3.f1" convention="chem4word:ResolvedFormula" inline="H2Mg" concise="Mg 1" />
    <cml:formula id="m3.f2" convention="chem4word:ResolvedSmiles" inline="[MgH2]" concise="Mg 1" />
    <cml:name id="m3.n1" dictRef="chem4word:CalculatedInchi">1S/Mg.2H</cml:name>
    <cml:name id="m3.n2" dictRef="chem4word:CalculatedInchikey">RSHAOIXHUHAZPM-UHFFFAOYSA-N</cml:name>
    <cml:name id="m3.n3" dictRef="chem4word:ResolvedIupacname">magnesium dihydride</cml:name>
    <cml:atomArray>
      <cml:atom id="a6" elementType="Mg" x2="692.7549" y2="599.5" />
    </cml:atomArray>
  </cml:molecule>
  <cml:reactionScheme id="rs1">
    <cml:reaction id="r1" c4w:head="646.265,600.0" c4w:tail="595.2258,600.0">
      <c4w:reagents>
        <FlowDocument mc:Ignorable="c4w" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:c4w="http://www.chem4word.com/cml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
          <Paragraph>
            <Run xml:lang="zh-tw">FGl</Run>
          </Paragraph>
        </FlowDocument>
      </c4w:reagents>
    </cml:reaction>
  </cml:reactionScheme>
</cml:cml>
MikeWilliams-UK commented 2 years ago

@tomyan112 can you please highlight which area(s) you think is/are mis aligned?

tomyan112 commented 2 years ago

@tomyan112 can you please highlight which area(s) you think is/are mis aligned? R²Mg image

Another example: image image

MikeWilliams-UK commented 2 years ago

Thanks @tomyan112 the last example is particularily puzzling

MikeWilliams-UK commented 2 years ago

Turning on diagnostic markers in the renderer shows that there are two issues here. Red spot shows the atom centre, Green rectangles show the character bounding box, Red polygon shows the Convex Hull

1) The editor is not positioning a singleton (Mg) correctly 2) The renderer is not positioning the pair of 123 lines correctly

image

MikeWilliams-UK commented 2 years ago

@tomyan112 is this the final alignment that you are trying to achieve for the R2 and Mg atoms?

image

tomyan112 commented 2 years ago

@tomyan112 is this the final alignment that you are trying to achieve for the R2 and Mg atoms?

image

Yes

MikeWilliams-UK commented 2 years ago

Fixed in Beta 2